diff options
13 files changed, 40 insertions, 128 deletions
diff --git a/container-core/src/main/resources/configdefinitions/qr-searchers.def b/container-core/src/main/resources/configdefinitions/qr-searchers.def index faf91f31aff..bb8f80052f1 100644 --- a/container-core/src/main/resources/configdefinitions/qr-searchers.def +++ b/container-core/src/main/resources/configdefinitions/qr-searchers.def @@ -14,6 +14,8 @@ com.yahoo.prelude.searcher.FieldCollapsingSearcher.extrafactor double default=2. com.yahoo.prelude.searcher.FieldCollapsingSearcher.collapsefield string default="mid" com.yahoo.prelude.searcher.BlendingSearcher.numthreads int default=200 + +# The field we'll unique on, use [id] to unique on the document id com.yahoo.prelude.searcher.BlendingSearcher.docid string default="" com.yahoo.prelude.searcher.JuniperSearcher.source string default="" diff --git a/container-search/src/main/java/com/yahoo/prelude/IndexModel.java b/container-search/src/main/java/com/yahoo/prelude/IndexModel.java index d2950078868..08e8612f9e9 100644 --- a/container-search/src/main/java/com/yahoo/prelude/IndexModel.java +++ b/container-search/src/main/java/com/yahoo/prelude/IndexModel.java @@ -39,8 +39,11 @@ public final class IndexModel { /** * Use IndexModel as a pure wrapper for the parameters given. + * + * @deprecated use the constructor without the third parameter */ - // TODO: Deprecate on Vespa 7 and remove on Vespa 8 + // TODO: Remove Vespa 8 + @Deprecated public IndexModel(Map<String, List<String>> masterClusters, Map<String, SearchDefinition> searchDefinitions, SearchDefinition unionSearchDefinition) { @@ -135,7 +138,8 @@ public final class IndexModel { public Map<String, SearchDefinition> getSearchDefinitions() { return searchDefinitions; } - // TODO: Deprecate on Vespa 7 and make package scope on Vespa 8 + /** @deprecated do not use */ + @Deprecated public SearchDefinition getUnionSearchDefinition() { return unionSearchDefinition; } } diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java index d9246bbc757..8d73f6795d4 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java @@ -77,7 +77,6 @@ public class FastHit extends Hit { // Note: This constructor is only used for tests, production use is always of the empty constructor public FastHit(String uri, double relevance, String source) { setId(uri); - super.setField("uri", uri); // TODO: Remove on Vespa 7 setRelevance(new Relevance(relevance)); setSource(source); types().add("summary"); @@ -97,13 +96,6 @@ public class FastHit extends Hit { URI uri = super.getId(); if (uri != null) return uri; - // TODO: Remove on Vespa 7, this should be one of the last vestiges of URL field magic - Object uriField = getField("uri"); - if (uriField != null) { - setId(uriField.toString()); - return super.getId(); - } - // Fallback to index:[source]/[partid]/[id] if (indexUri != null) return indexUri; StringBuilder sb = new StringBuilder(64); diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/BlendingSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/BlendingSearcher.java index 28d384b0f63..61ce9d98e69 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/BlendingSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/BlendingSearcher.java @@ -38,21 +38,20 @@ public class BlendingSearcher extends Searcher { public static final String BLENDING = "Blending"; - private final String documentId; + private final String blendingField; @Inject public BlendingSearcher(ComponentId id, QrSearchersConfig cfg) { super(id); QrSearchersConfig.Com.Yahoo.Prelude.Searcher.BlendingSearcher s = cfg.com().yahoo().prelude().searcher().BlendingSearcher(); - documentId = s.docid().length() > 0 ? s.docid() : null; - + blendingField = s.docid().length() > 0 ? s.docid() : null; } /** * Only for legacy tests. */ - public BlendingSearcher(String blendingDocumentId) { - this.documentId = blendingDocumentId; + public BlendingSearcher(String blendingField) { + this.blendingField = blendingField; } @Override @@ -107,7 +106,7 @@ public class BlendingSearcher extends Searcher { result.hits().setOrderer(groups.get(0).getOrderer()); return result; } else { - if (documentId != null) { + if (blendingField != null) { return blendResultsUniquely(result, q, offset, hits, groups, execution); } else { return blendResultsDirectly(result, q, offset, hits, groups, execution); @@ -125,6 +124,7 @@ public class BlendingSearcher extends Searcher { } private abstract class DocumentMerger { + protected Set<String> documentsToStrip; protected Result result; protected HitGroup group; @@ -137,22 +137,22 @@ public class BlendingSearcher extends Searcher { return result; } - //Since we cannot use prelude.hit#getProperty, we'll have to improvise private String getProperty(Hit hit, String field) { + if ("[id]".equals(field)) return hit.getId().toString(); Object o = hit.getField(field); return o == null ? null : o.toString(); } protected void storeID(Hit hit, Execution execution) { - String id = getProperty(hit, documentId); + String id = getProperty(hit, blendingField); if (id != null) { documentsToStrip.add(id); } else { if (!result.isFilled(result.getQuery().getPresentation().getSummary())) { fill(result, result.getQuery().getPresentation().getSummary(), execution); - id = getProperty(hit, documentId); + id = getProperty(hit, blendingField); if (id != null) { documentsToStrip.add(id); } @@ -161,14 +161,14 @@ public class BlendingSearcher extends Searcher { } protected boolean known(HitGroup source, Hit hit, Execution execution) { - String stripID = getProperty(hit, documentId); + String stripID = getProperty(hit, blendingField); if (stripID == null) { if (!source.isFilled(result.getQuery().getPresentation().getSummary())) { Result nResult = new Result(result.getQuery()); nResult.hits().add(source); fill(nResult, nResult.getQuery().getPresentation().getSummary(), execution); - stripID = getProperty(hit, documentId); + stripID = getProperty(hit, blendingField); if (stripID == null) { return false; } diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java index b8b85eb4a5d..9e043bc3dc9 100644 --- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java +++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java @@ -113,7 +113,6 @@ public class QueryProperties extends Properties { else if (key.size()==2 && key.first().equals(Presentation.PRESENTATION)) { if (key.last().equals(Presentation.BOLDING)) return query.getPresentation().getBolding(); if (key.last().equals(Presentation.SUMMARY)) return query.getPresentation().getSummary(); - if (key.last().equals(Presentation.REPORT_COVERAGE)) return true; // TODO: Remove this line on Vespa 7 if (key.last().equals(Presentation.FORMAT)) return query.getPresentation().getFormat(); if (key.last().equals(Presentation.TIMING)) return query.getPresentation().getTiming(); if (key.last().equals(Presentation.SUMMARY_FIELDS)) return query.getPresentation().getSummaryFields(); @@ -243,7 +242,7 @@ public class QueryProperties extends Properties { query.getPresentation().setTiming(asBoolean(value, true)); else if (key.last().equals(Presentation.SUMMARY_FIELDS)) query.getPresentation().setSummaryFields(asString(value,"")); - else if ( ! key.last().equals(Presentation.REPORT_COVERAGE)) // TODO: Change this line to "else" on Vespa 7 + else throwIllegalParameter(key.last(), Presentation.PRESENTATION); } else if (key.size()==2 && key.first().equals(Select.SELECT)) { diff --git a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java index 7d60d7cf9ee..c102d1fa258 100644 --- a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java +++ b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java @@ -473,7 +473,7 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> { generator.writeNumberField(RELEVANCE, hit.getRelevance().getScore()); - if (hit.types().size() > 0) { // TODO: Remove types rendering on Vespa 7 + if (hit.types().size() > 0) { generator.writeArrayFieldStart(TYPES); for (String t : hit.types()) { generator.writeString(t); diff --git a/container-search/src/main/java/com/yahoo/search/result/Hit.java b/container-search/src/main/java/com/yahoo/search/result/Hit.java index fdfa58730fc..bcff370685f 100644 --- a/container-search/src/main/java/com/yahoo/search/result/Hit.java +++ b/container-search/src/main/java/com/yahoo/search/result/Hit.java @@ -106,9 +106,7 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi /** If this is true, then this hit will not be counted as a concrete hit */ private boolean auxiliary = false; - /** - * The hit field used to store rank features. TODO: Remove on Vespa 7 - */ + /** The hit field used to store rank features */ public static final String RANKFEATURES_FIELD = "rankfeatures"; public static final String SDDOCNAME_FIELD = "sddocname"; diff --git a/container-search/src/main/resources/configdefinitions/qr-binary-cache-region.def b/container-search/src/main/resources/configdefinitions/qr-binary-cache-region.def deleted file mode 100644 index ba2b6ed7802..00000000000 --- a/container-search/src/main/resources/configdefinitions/qr-binary-cache-region.def +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -# TODO: Not in use - remove on Vespa 7 - -namespace=search.cache - -# size of the region (in MB). Cache size (in qr-binary-cache.cfg) -# and region size should be same -region_size int default=1024 - -# Number of threads that would concurrently access cache -concurrency_level int default=50 - -# Initial bucket count that would be created in a region -# (rehashing would grow it if necessary but is expensive) -bucket_count int default=12000 - -# Load factor of the region. -load_factor double default=0.75 - -#TTL in milli-seconds -time_to_live int default=-1 - -entry_size_range int default=500 - - -#Whether lazy invalidation is enabled or no -lazy_invalidation_enabled bool default=false - -# Time interval (in seconds) over which lazy invalidation parameters would be observed -tick_interval int default=1 -tick_count_to_average int default=10 - -# Maximum QPS that can be supported by the back-end. -# Refresh due to lazy invalidation and TTL would be disabled in the -# tick_interval in which total requests to backend have exceeded MAX_QPS -max_backend_qps int default=300 - -# Log file in which lazy invalidation stats would be -# recorded (keep it empty if no stats are required) -lazy_invalidation_stats_file string default="lstats.log" - -# Maximum stale time in seconds after a call to lazy invalidation is made. -# Once this time interval is expired, any request for an expired -# entry (due to TTL or lazy invalidation) would result in a cache miss. -lazy_invalidation_max_stale_time_in_sec int default=1000 diff --git a/container-search/src/main/resources/configdefinitions/qr-binary-cache.def b/container-search/src/main/resources/configdefinitions/qr-binary-cache.def deleted file mode 100644 index 917832e86fe..00000000000 --- a/container-search/src/main/resources/configdefinitions/qr-binary-cache.def +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -# TODO: Not in use - remove on Vespa 7 - -namespace=search.cache - -# Size of a block in cache. A block is the smallest unit that would -# be allocated to a cache entry (key+value). Multiple blocks can be -# allocated to an entry if required and blocks can not be shared -# between multiple entries. IN BYTES -block_size int default=256 - -# Size of a buffer array that would hold the serialized content, -# maximum size here can be 2 GB. IN MB -buffer_size int default=64 - -# For debugging (for production it should be true) -assertions_disabled bool default=false - -# Whether to create the byte buffers in the NIO memory or in -# JVM heap itself (having these in NIO buffers gives lower GC pause times) -use_direct_buffers bool default=true - -# Size of the byte array pool that the cache uses to hold up -# the serialized content temporarily -pooled_byte_arrays int default=1000 - -# The size of the cahe in MB -# If the size is 0, the cache is disabled -cache_size int default=0 - -# If true, cache would write average time taken in various -# operations per 1000 requests in log -profiling_enabled bool default=false - -# For debugging purposes -lock_verification_enabled bool default=false diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java index fae869c5235..47009eb703b 100644 --- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java @@ -51,20 +51,20 @@ public class BlendingSearcherTestCase { private final Map<String, Searcher> searchers = new HashMap<>(); private SearchChainRegistry chainRegistry; - private final String blendingDocumentId; + private final String blendingField; public BlendingSearcherWrapper() { - blendingDocumentId = null; + blendingField = null; } - public BlendingSearcherWrapper(String blendingDocumentId) { - this.blendingDocumentId = blendingDocumentId; + public BlendingSearcherWrapper(String blendingField) { + this.blendingField = blendingField; } @SuppressWarnings("serial") public BlendingSearcherWrapper(QrSearchersConfig cfg) { QrSearchersConfig.Com.Yahoo.Prelude.Searcher.BlendingSearcher s = cfg.com().yahoo().prelude().searcher().BlendingSearcher(); - blendingDocumentId = s.docid().length() > 0 ? s.docid() : null; + blendingField = s.docid().length() > 0 ? s.docid() : null; } public boolean addChained(Searcher searcher, String sourceName) { @@ -109,7 +109,7 @@ public class BlendingSearcherTestCase { FederationSearcher fedSearcher = new FederationSearcher(new FederationConfig(builder), contracts, new ComponentRegistry<>()); - BlendingSearcher blendingSearcher = new BlendingSearcher(blendingDocumentId); + BlendingSearcher blendingSearcher = new BlendingSearcher(blendingField); blendingChain = new SearchChain(ComponentId.createAnonymousComponentId("blendingChain"), blendingSearcher, fedSearcher); return true; } @@ -217,7 +217,7 @@ public class BlendingSearcherTestCase { r2.setTotalHitCount(1); chain2.addResult(q, r2); - BlendingSearcherWrapper blender = new BlendingSearcherWrapper("uri"); + BlendingSearcherWrapper blender = new BlendingSearcherWrapper("[id]"); blender.addChained(new FillSearcher(chain1), "a"); blender.addChained(new FillSearcher(chain2), "b"); blender.initialize(); diff --git a/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java b/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java index 5b3b5ca6d73..9e16ddba6fc 100644 --- a/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java @@ -498,8 +498,7 @@ public class JsonRendererTestCase { + " \"children\": [\n" + " {\n" + " \"fields\": {\n" - + " \"c\": \"d\",\n" - + " \"uri\": \"http://localhost/1\"\n" + + " \"c\": \"d\"\n" + " },\n" + " \"id\": \"http://localhost/1\",\n" + " \"relevance\": 0.9,\n" @@ -523,8 +522,7 @@ public class JsonRendererTestCase { + " },\n" + " {\n" + " \"fields\": {\n" - + " \"b\": \"foo\",\n" - + " \"uri\": \"http://localhost/\"\n" + + " \"b\": \"foo\"\n" + " },\n" + " \"id\": \"http://localhost/\",\n" + " \"relevance\": 0.95,\n" @@ -555,7 +553,7 @@ public class JsonRendererTestCase { + " \"relevance\": 1.0\n" + " }\n" + "}"; - Query q = new Query("/?query=a&tracelevel=5&reportCoverage=true"); + Query q = new Query("/?query=a&tracelevel=5"); Execution execution = new Execution(Execution.Context.createContextStub()); Result r = new Result(q); r.setCoverage(new Coverage(500, 500,1,1)); @@ -603,7 +601,7 @@ public class JsonRendererTestCase { + " \"relevance\": 1.0\n" + " }\n" + "}"; - Query q = new Query("/?query=a&tracelevel=5&reportCoverage=true"); + Query q = new Query("/?query=a&tracelevel=5"); Execution execution = new Execution(Execution.Context.createContextStub()); Result r = new Result(q); r.setCoverage(new Coverage(500, 600).setDegradedReason(5)); @@ -725,7 +723,7 @@ public class JsonRendererTestCase { + " \"relevance\": 1.0\n" + " }\n" + "}\n"; - Query q = new Query("/?query=a&tracelevel=5&reportCoverage=true"); + Query q = new Query("/?query=a&tracelevel=5"); Result r = new Result(q); Throwable t = new Throwable(); StackTraceElement[] stack = new StackTraceElement[1]; diff --git a/container-search/src/test/java/com/yahoo/search/rendering/SyncDefaultRendererTestCase.java b/container-search/src/test/java/com/yahoo/search/rendering/SyncDefaultRendererTestCase.java index 1d2187376a4..acb69670b14 100644 --- a/container-search/src/test/java/com/yahoo/search/rendering/SyncDefaultRendererTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/rendering/SyncDefaultRendererTestCase.java @@ -58,8 +58,8 @@ public class SyncDefaultRendererTestCase { @SuppressWarnings("deprecation") @Test - public final void testRenderWriterResult() throws InterruptedException, ExecutionException { - Query q = new Query("/?query=a&tracelevel=5&reportCoverage=true"); + public void testRenderWriterResult() throws InterruptedException, ExecutionException { + Query q = new Query("/?query=a&tracelevel=5"); q.getPresentation().setTiming(true); Result r = new Result(q); r.setCoverage(new Coverage(500, 1)); @@ -96,7 +96,7 @@ public class SyncDefaultRendererTestCase { assertTrue(f.get()); String summary = Utf8.toString(bs.toByteArray()); // TODO figure out a reasonably strict and reasonably flexible way to test - assertTrue(summary.length() > 1000); + assertTrue(summary.length() > 900); } } diff --git a/container-search/src/test/java/com/yahoo/search/rendering/XMLRendererTestCase.java b/container-search/src/test/java/com/yahoo/search/rendering/XMLRendererTestCase.java index 3ecb057d176..ea3b46aaaa9 100644 --- a/container-search/src/test/java/com/yahoo/search/rendering/XMLRendererTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/rendering/XMLRendererTestCase.java @@ -54,8 +54,8 @@ public class XMLRendererTestCase { } @Test - public final void testImplicitDefaultRender() throws Exception { - Query q = new Query("/?query=a&tracelevel=5&reportCoverage=true"); + public void testImplicitDefaultRender() throws Exception { + Query q = new Query("/?query=a&tracelevel=5"); q.getPresentation().setTiming(true); Result r = new Result(q); r.setCoverage(new Coverage(500, 1)); @@ -102,7 +102,7 @@ public class XMLRendererTestCase { assertTrue(summary.contains("<hit type=\"grouphit\" relevancy=\"1.0\">")); assertTrue(summary.contains("<hit type=\"summary\" relevancy=\"0.95\">")); assertEquals(2, occurrences("<error ", summary)); - assertTrue(summary.length() > 1000); + assertTrue(summary.length() > 900); } private int occurrences(String fragment, String string) { |