diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2017-08-28 12:48:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 12:48:41 +0200 |
commit | 7139650d8e789f1e9f12c89c1a716bb12f4c64c5 (patch) | |
tree | 5348fe08d817de99ea1991a0f8f94509ecf5604e | |
parent | 24894bf4e3dcbc9af5ce55943976437d48947afc (diff) | |
parent | 7d4b8d465f2b0d1e9005a612cf8373908a33ffb6 (diff) |
Merge branch 'master' into freva/throw-exception-invalid-remove-node
4 files changed, 59 insertions, 1 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java index 3369eb64094..1a7e693caa7 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java @@ -396,6 +396,16 @@ public abstract class VespaBackEndSearcher extends PingableSearcher { s.append(" location=") .append(query.getRanking().getLocation().toString()); } + + if (query.getGroupingSessionCache()) { + s.append(" groupingSessionCache=true"); + } + if (query.getRanking().getQueryCache()) { + s.append(" ranking.queryCache=true"); + } + if (query.getGroupingSessionCache() || query.getRanking().getQueryCache()) { + s.append(" sessionId=" + query.getSessionId(true)); + } List<Grouping> grouping = GroupingExecutor.getGroupingList(query); s.append(" grouping=").append(grouping.size()).append(" : "); diff --git a/container-search/src/main/java/com/yahoo/search/query/SessionId.java b/container-search/src/main/java/com/yahoo/search/query/SessionId.java index c6e34e7e430..b065bd9a0a9 100644 --- a/container-search/src/main/java/com/yahoo/search/query/SessionId.java +++ b/container-search/src/main/java/com/yahoo/search/query/SessionId.java @@ -22,4 +22,19 @@ public class SessionId { } public Utf8String asUtf8String() { return id; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + SessionId sessionId = (SessionId) o; + + return id.equals(sessionId.id); + } + + @Override + public int hashCode() { + return id.hashCode(); + } } diff --git a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java index ce9e3357c77..3ffc5dbcf78 100644 --- a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java @@ -23,6 +23,7 @@ import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.Searcher; import com.yahoo.search.query.QueryTree; +import com.yahoo.search.query.SessionId; import com.yahoo.search.query.profile.QueryProfile; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.search.result.Hit; @@ -44,6 +45,7 @@ import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -637,6 +639,37 @@ public class QueryTestCase { } @Test + public void testThatSessionIdIsUniquePerQuery() { + Query q = new Query(); + assertNull(q.getSessionId(false)); + assertNull(q.getSessionId(false)); + SessionId s1 = q.getSessionId(true); + assertNotNull(s1); + SessionId s2 = q.getSessionId(true); + assertNotSame(s1, s2); + assertEquals(s1, s2); + assertEquals(s1.toString(), s2.toString()); + + Query q2 = new Query(); + assertNotEquals(q.getSessionId(false), q2.getSessionId(true)); + assertNotEquals(q.getSessionId(false).toString(), q2.getSessionId(true).toString()); + + // This is not required, but just to document current implementation. + Query clonedQ = q.clone(); + assertNotNull(clonedQ.getSessionId(false)); + assertEquals(q.getSessionId(false), q.getSessionId(false)); + } + + @Test + public void testThatSessionIdIsUniquePerRankProfilePerQuery() { + Query q = new Query(); + SessionId s1 = q.getSessionId(true); + q.getRanking().setProfile("my-profile"); + SessionId s2 = q.getSessionId(false); + assertNotEquals(s1, s2); + } + + @Test public void testPositiveTerms() { Query q = new Query(httpEncode("/?query=-a \"b c\" d e")); Item i = q.getModel().getQueryTree().getRoot(); diff --git a/travis/travis-build-cpp.sh b/travis/travis-build-cpp.sh index 334cc276ce3..4386be3b878 100755 --- a/travis/travis-build-cpp.sh +++ b/travis/travis-build-cpp.sh @@ -7,7 +7,7 @@ BUILD_DIR=~/build mkdir "${BUILD_DIR}" -export CCACHE_SIZE="1G" +export CCACHE_MAXSIZE="1G" export CCACHE_COMPRESS=1 NUM_THREADS=4 ccache --print-config |