diff options
19 files changed, 87 insertions, 65 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java index e60aabd24e8..659a07cfd5c 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java @@ -60,7 +60,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl return s.toString(); } - private int getGCInterval(ModelElement documentNode) throws ParseException { + private int getGCInterval(ModelElement documentNode) { int gcInterval = 3600; if (documentNode != null) { gcInterval = documentNode.getIntegerAttribute("garbage-collection-interval", gcInterval); diff --git a/container-search/src/main/java/com/yahoo/prelude/IndexFacts.java b/container-search/src/main/java/com/yahoo/prelude/IndexFacts.java index b899f690ee1..bdf395c1f0b 100644 --- a/container-search/src/main/java/com/yahoo/prelude/IndexFacts.java +++ b/container-search/src/main/java/com/yahoo/prelude/IndexFacts.java @@ -166,8 +166,8 @@ public class IndexFacts { } private Index getIndexFromDocumentTypes(String indexName, List<String> documentTypes) { - if (indexName==null || indexName.isEmpty()) - indexName="default"; + if (indexName == null || indexName.isEmpty()) + indexName = "default"; return getIndexByCanonicNameFromDocumentTypes(indexName, documentTypes); } @@ -191,6 +191,13 @@ public class IndexFacts { return Index.nullIndex; } + private Collection<Index> getIndexes(String documentType) { + if ( ! isInitialized()) return Collections.emptyList(); + SearchDefinition sd = searchDefinitions.get(documentType); + if (sd == null) return Collections.emptyList(); + return sd.indices().values(); + } + /** Calls resolveDocumentTypes(query.getModel().getSources(), query.getModel().getRestrict()) */ private Set<String> resolveDocumentTypes(Query query) { // Assumption: Search definition name equals document name. @@ -421,6 +428,11 @@ public class IndexFacts { return IndexFacts.this.getIndexFromDocumentTypes(indexName, Collections.singletonList(documentType)); } + /** Returns all the indexes of a given search definition */ + public Collection<Index> getIndexes(String documentType) { + return IndexFacts.this.getIndexes(documentType); + } + /** * Returns the canonical form of the index name (Which may be the same as * the input). diff --git a/container-search/src/main/java/com/yahoo/prelude/SearchDefinition.java b/container-search/src/main/java/com/yahoo/prelude/SearchDefinition.java index 644cacfa322..47becde7b19 100644 --- a/container-search/src/main/java/com/yahoo/prelude/SearchDefinition.java +++ b/container-search/src/main/java/com/yahoo/prelude/SearchDefinition.java @@ -83,7 +83,7 @@ public class SearchDefinition { } /** Returns the indices of this as a map */ - public Map<String,Index> indices() { + public Map<String, Index> indices() { return indices; } diff --git a/container-search/src/main/java/com/yahoo/prelude/logging/AccessLogEntry.java b/container-search/src/main/java/com/yahoo/prelude/logging/AccessLogEntry.java index e38c30c25ac..9d852c8822d 100644 --- a/container-search/src/main/java/com/yahoo/prelude/logging/AccessLogEntry.java +++ b/container-search/src/main/java/com/yahoo/prelude/logging/AccessLogEntry.java @@ -4,8 +4,10 @@ package com.yahoo.prelude.logging; /** * Hollow compatibility class for com.yahoo.container.logging.AccessLogEntry. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen + * @deprecated do not use */ +@Deprecated // TODO: Remove on Vespa 7 public class AccessLogEntry extends com.yahoo.container.logging.AccessLogEntry { public AccessLogEntry() { diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/CollapsePhraseSearcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/CollapsePhraseSearcher.java index abf37c71b76..47e5651f64c 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/CollapsePhraseSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/CollapsePhraseSearcher.java @@ -15,9 +15,11 @@ import com.yahoo.search.searchchain.Execution; /** * Make single item phrases in query into single word items. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ public class CollapsePhraseSearcher extends Searcher { + + @Override public Result search(Query query, Execution execution) { QueryTree tree = query.getModel().getQueryTree(); Item root = tree.getRoot(); @@ -35,7 +37,6 @@ public class CollapsePhraseSearcher extends Searcher { return execution.search(query); } - private Item simplifyPhrases(Item root) { if (root == null) { return root; @@ -64,4 +65,5 @@ public class CollapsePhraseSearcher extends Searcher { else return root; } + } diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/IndexCombinatorSearcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/IndexCombinatorSearcher.java index 3d803b322ca..dd8f4eff666 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/IndexCombinatorSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/IndexCombinatorSearcher.java @@ -22,14 +22,15 @@ import java.util.*; * Searcher to rewrite queries to achieve mixed recall between indices and * memory attributes. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen + * @deprecated do not use */ @After({PhaseNames.RAW_QUERY, PHRASE_REPLACEMENT}) @Before(PhaseNames.TRANSFORMED_QUERY) @Provides(IndexCombinatorSearcher.MIXED_RECALL_REWRITE) -// TODO: This is not necessary on Vespa 6, we should probably remove it from the default chain but keep it -// around until Vespa 6 to avoid breaking those who refer to it. +@Deprecated // TODO: Remove on Vespa 7 (not necessary any more) public class IndexCombinatorSearcher extends Searcher { + public static final String MIXED_RECALL_REWRITE = "MixedRecallRewrite"; private static class ArrayComparator implements Comparator<Attribute[]> { diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/NoRankingSearcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/NoRankingSearcher.java index 72c38448936..7456f33d00f 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/NoRankingSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/NoRankingSearcher.java @@ -1,16 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.prelude.querytransform; - import java.util.List; import com.yahoo.component.chain.dependencies.After; import com.yahoo.component.chain.dependencies.Before; +import com.yahoo.search.Query; +import com.yahoo.search.Result; import com.yahoo.search.Searcher; import com.yahoo.search.query.Sorting.FieldOrder; import com.yahoo.search.searchchain.Execution; - /** * Avoid doing relevance calculations if sorting only * on attributes. @@ -25,7 +25,7 @@ public class NoRankingSearcher extends Searcher { private static final String UNRANKED = "unranked"; @Override - public com.yahoo.search.Result search(com.yahoo.search.Query query, Execution execution) { + public Result search(Query query, Execution execution) { List<FieldOrder> s = (query.getRanking().getSorting() != null) ? query.getRanking().getSorting().fieldOrders() : null; if (s == null) { return execution.search(query); diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/NonPhrasingSearcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/NonPhrasingSearcher.java index 7a548acbff7..ffb1b8a4965 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/NonPhrasingSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/NonPhrasingSearcher.java @@ -5,6 +5,8 @@ import com.yahoo.component.ComponentId; import com.yahoo.component.chain.dependencies.After; import com.yahoo.component.chain.dependencies.Before; import com.yahoo.container.QrSearchersConfig; +import com.yahoo.search.Query; +import com.yahoo.search.Result; import com.yahoo.search.Searcher; import com.yahoo.processing.request.CompoundName; import com.yahoo.search.searchchain.Execution; @@ -12,7 +14,7 @@ import com.yahoo.search.searchchain.Execution; import java.util.List; /** - * <p>Detects and removes certain phrases from the query.</p> + * Detects and removes certain phrases from the query. * * @author bratseth */ @@ -52,9 +54,9 @@ public class NonPhrasingSearcher extends Searcher { } @Override - public com.yahoo.search.Result search(com.yahoo.search.Query query, Execution execution) { - List<PhraseMatcher.Phrase> phrases=phraseMatcher.matchPhrases(query.getModel().getQueryTree().getRoot()); - if (phrases!=null && !query.properties().getBoolean(suggestonly, false)) { + public Result search(Query query, Execution execution) { + List<PhraseMatcher.Phrase> phrases = phraseMatcher.matchPhrases(query.getModel().getQueryTree().getRoot()); + if (phrases != null && !query.properties().getBoolean(suggestonly, false)) { remove(phrases); query.trace("Removing stop words",true,2); } @@ -64,9 +66,9 @@ public class NonPhrasingSearcher extends Searcher { private void remove(List<PhraseMatcher.Phrase> phrases) { // Removing the leaf replace phrases first to preserve // the start index of each replace phrase until removing - for (int i=phrases.size()-1; i>=0; i-- ) { - PhraseMatcher.Phrase phrase= phrases.get(i); - if (phrase.getLength()<phrase.getOwner().getItemCount()) // Don't removeField all + for (int i = phrases.size()-1; i >= 0; i-- ) { + PhraseMatcher.Phrase phrase = phrases.get(i); + if (phrase.getLength() < phrase.getOwner().getItemCount()) // Don't removeField all phrase.remove(); } } diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/NormalizingSearcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/NormalizingSearcher.java index 02c8ecda60c..fdd6ad47a98 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/NormalizingSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/NormalizingSearcher.java @@ -11,6 +11,7 @@ import com.yahoo.prelude.IndexFacts; import com.yahoo.prelude.IndexFacts.Session; import com.yahoo.prelude.query.*; import com.yahoo.prelude.query.WordAlternativesItem.Alternative; +import com.yahoo.search.Result; import com.yahoo.search.Searcher; import com.yahoo.language.Language; import com.yahoo.language.Linguistics; @@ -46,7 +47,7 @@ public class NormalizingSearcher extends Searcher { } @Override - public com.yahoo.search.Result search(com.yahoo.search.Query query, Execution execution) { + public Result search(Query query, Execution execution) { normalize(query, execution.context().getIndexFacts().newSession(query)); return execution.search(query); } diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java index f4891489216..e8e4dc39fd5 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java @@ -20,15 +20,15 @@ public class PhraseMatcher { private FSA phraseFSA = null; - private boolean matchPhraseItems=false; + private boolean matchPhraseItems = false; - private boolean matchSingleItems=false; + private boolean matchSingleItems = false; /** Whether this should ignore regular plural/singular form differences when matching */ - private boolean ignorePluralForm=false; + private boolean ignorePluralForm = false; /** False to matche the longest phrase, true to match <i>all</i> phrases */ - private boolean matchAll =false; + private boolean matchAll = false; /** For null subclass only */ private PhraseMatcher() { diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/PhrasingSearcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/PhrasingSearcher.java index d530ec6b45e..2f3f4dbd351 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/PhrasingSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/PhrasingSearcher.java @@ -29,7 +29,7 @@ import java.util.List; @Provides(PhrasingSearcher.PHRASE_REPLACEMENT) public class PhrasingSearcher extends Searcher { - private static final CompoundName suggestonly=new CompoundName("suggestonly"); + private static final CompoundName suggestonly = new CompoundName("suggestonly"); public static final String PHRASE_REPLACEMENT = "PhraseReplacement"; diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/RecallSearcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/RecallSearcher.java index 4490d3c9b1e..69331a196a2 100644 --- a/container-search/src/main/java/com/yahoo/prelude/querytransform/RecallSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/RecallSearcher.java @@ -38,7 +38,7 @@ public class RecallSearcher extends Searcher { private static final CompoundName recallName=new CompoundName("recall"); @Override - public com.yahoo.search.Result search(Query query, Execution execution) { + public Result search(Query query, Execution execution) { String recall = query.properties().getString(recallName); if (recall == null) return execution.search(query); diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/DocumentSourceSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/DocumentSourceSearcher.java index 415ebd7871c..2f9e81c1607 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/DocumentSourceSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/DocumentSourceSearcher.java @@ -27,9 +27,12 @@ import java.util.Set; * will be returned when attribute prefetch filling is requested.</p> * * @author bratseth + * @deprecated use {@link com.yahoo.search.searchchain.testutil.DocumentSourceSearcher} */ @SuppressWarnings({"rawtypes"}) +@Deprecated // TODO: Remove on Vespa 7 public class DocumentSourceSearcher extends Searcher { + // as for the SuppressWarnings annotation above, we are inside // com.yahoo.prelude, this is old stuff, really no point firing off those // warnings here... @@ -38,7 +41,6 @@ public class DocumentSourceSearcher extends Searcher { private Map<Query, Result> completelyFilledResults = new HashMap<>(); private Map<Query, Result> attributeFilledResults = new HashMap<>(); private Map<Query, Result> unFilledResults = new HashMap<>(); - //private Result defaultUnfilledResult; /** Time (in ms) at which the index of this searcher was last modified */ long editionTimeStamp=0; @@ -101,11 +103,11 @@ public class DocumentSourceSearcher extends Searcher { } /** - * Returns a query clone which has offset and hits set to null. This is used by access to + * Returns a query clone which has source, offset and hits set to null. This is used by access to * the maps using the query as key to achieve lookup independent of offset/hits value */ - private com.yahoo.search.Query getQueryKeyClone(com.yahoo.search.Query query) { - com.yahoo.search.Query key=query.clone(); + private Query getQueryKeyClone(Query query) { + Query key = query.clone(); key.setWindow(0,0); key.getModel().setSources(""); return key; diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/FieldCollapsingSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/FieldCollapsingSearcher.java index 71e54c810c2..21fa8962da4 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/FieldCollapsingSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/FieldCollapsingSearcher.java @@ -19,10 +19,9 @@ import java.util.Map; /** - * A searcher which does parametrized collapsing. Based on - * SiteCollapsingSearcher. Deprecated - use grouping. + * A searcher which does parametrized collapsing. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ @SuppressWarnings("deprecation") @After(PhaseNames.RAW_QUERY) @@ -174,17 +173,18 @@ public class FieldCollapsingSearcher extends Searcher { } if (knownCollapses.containsKey(collapseId)) { - int numHitsThisField = knownCollapses.get(collapseId).intValue(); + int numHitsThisField = knownCollapses.get(collapseId); if (numHitsThisField < collapseSize) { result.hits().add(hit); ++numHitsThisField; - knownCollapses.put(collapseId, Integer.valueOf(numHitsThisField)); + knownCollapses.put(collapseId, numHitsThisField); } } else { - knownCollapses.put(collapseId, Integer.valueOf(1)); + knownCollapses.put(collapseId, 1); result.hits().add(hit); } } } + } diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/JSONDebugSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/JSONDebugSearcher.java index c18f3d49da3..2330ca2382a 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/JSONDebugSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/JSONDebugSearcher.java @@ -16,16 +16,17 @@ import java.util.Iterator; /** * Save the query in the incoming state to a meta hit in the result. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ - public class JSONDebugSearcher extends Searcher { + public static final String JSON_FIELD = "JSON field: "; public static final String STRUCT_FIELD = "Structured data field (as json): "; public static final String FEATURE_FIELD = "Feature data field (as json): "; private static CompoundName PROPERTYNAME = new CompoundName("dumpjson"); + @Override public Result search(com.yahoo.search.Query query, Execution execution) { Result r = execution.search(query); String propertyName = query.properties().getString(PROPERTYNAME); @@ -53,4 +54,5 @@ public class JSONDebugSearcher extends Searcher { } return r; } + } diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentFieldTemplate.java b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentFieldTemplate.java index 7a59be49458..4390f70cac0 100755 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentFieldTemplate.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentFieldTemplate.java @@ -7,7 +7,6 @@ import com.yahoo.document.Field; import com.yahoo.document.datatypes.FieldValue; import com.yahoo.document.datatypes.Raw; import com.yahoo.io.ByteWriter; -import com.yahoo.prelude.templates.Context; import com.yahoo.text.XML; import java.io.IOException; @@ -38,7 +37,7 @@ public class DocumentFieldTemplate extends com.yahoo.prelude.templates.UserTempl } @Override - public void error(Context context, Writer writer) throws IOException { + public void error(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { // Error shouldn't be handled by this template, but rather // delegated to the searcher } @@ -55,7 +54,7 @@ public class DocumentFieldTemplate extends com.yahoo.prelude.templates.UserTempl } @Override - public void header(Context context, Writer writer) throws IOException { + public void header(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { if (wrapXml) { // XML wrapping should only be used for default field rendering writer.write("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n"); @@ -64,14 +63,14 @@ public class DocumentFieldTemplate extends com.yahoo.prelude.templates.UserTempl } @Override - public void footer(Context context, Writer writer) throws IOException { + public void footer(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { if (wrapXml) { writer.write("</result>\n"); } } @Override - public void hit(Context context, Writer writer) throws IOException { + public void hit(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { DocumentHit hit = (DocumentHit)context.get("hit"); Document doc = hit.getDocument(); // Assume field existence has been checked before we ever get here. @@ -88,11 +87,11 @@ public class DocumentFieldTemplate extends com.yahoo.prelude.templates.UserTempl } @Override - public void hitFooter(Context context, Writer writer) throws IOException { + public void hitFooter(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { } @Override - public void noHits(Context context, Writer writer) throws IOException { + public void noHits(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { } } diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentXMLTemplate.java b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentXMLTemplate.java index 25ee0ff5d03..b16f39800ef 100755 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentXMLTemplate.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/DocumentXMLTemplate.java @@ -6,7 +6,6 @@ import com.yahoo.search.Result; import com.yahoo.search.result.ErrorHit; import com.yahoo.search.result.ErrorMessage; import com.yahoo.search.result.HitGroup; -import com.yahoo.prelude.templates.Context; import com.yahoo.search.result.Hit; import com.yahoo.text.XML; @@ -55,7 +54,7 @@ public class DocumentXMLTemplate extends com.yahoo.prelude.templates.UserTemplat } @Override - public void error(Context context, Writer writer) throws IOException { + public void error(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { writer.write("<errors>\n"); // If the error contains no error hits, use a single error with the main // code and description. Otherwise, use the error hits explicitly @@ -72,7 +71,7 @@ public class DocumentXMLTemplate extends com.yahoo.prelude.templates.UserTemplat } @Override - public void header(Context context, Writer writer) throws IOException { + public void header(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); writer.write("<result>\n"); HitGroup rootGroup = ((Result) context.get("result")).hits(); @@ -82,12 +81,12 @@ public class DocumentXMLTemplate extends com.yahoo.prelude.templates.UserTemplat } @Override - public void footer(Context context, Writer writer) throws IOException { + public void footer(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { writer.write("</result>\n"); } @Override - public void hit(Context context, Writer writer) throws IOException { + public void hit(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { Hit hit = (Hit)context.get("hit"); if (hit instanceof DocumentHit) { DocumentHit docHit = (DocumentHit) hit; @@ -110,11 +109,11 @@ public class DocumentXMLTemplate extends com.yahoo.prelude.templates.UserTemplat } @Override - public void hitFooter(Context context, Writer writer) throws IOException { + public void hitFooter(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { } @Override - public void noHits(Context context, Writer writer) throws IOException { + public void noHits(com.yahoo.prelude.templates.Context context, Writer writer) throws IOException { } } diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java index 5f1c96d000f..835a11bf7c2 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientFeederV3.java @@ -183,9 +183,9 @@ class ClientFeederV3 { if (! operationId.isPresent()) { return Optional.empty(); } - final DocumentOperationMessageV3 msg; + final DocumentOperationMessageV3 message; try { - msg = getNextMessage(operationId.get(), requestInputStream, settings); + message = getNextMessage(operationId.get(), requestInputStream, settings); } catch (Exception e) { if (log.isLoggable(LogLevel.DEBUG)) { log.log(LogLevel.DEBUG, Exceptions.toMessageString(e), e); @@ -195,8 +195,9 @@ class ClientFeederV3 { continue; } - setRoute(msg, settings); - return Optional.of(msg); + if (message != null) + setRoute(message, settings); + return Optional.ofNullable(message); } } @@ -273,6 +274,7 @@ class ClientFeederV3 { } // protected for mocking + /** Returns the next message in the stream, or null if none */ protected DocumentOperationMessageV3 getNextMessage( String operationId, InputStream requestInputStream, FeederSettings settings) throws Exception { VespaXMLFeedReader.Operation operation = streamReaderV3.getNextOperation(requestInputStream, settings); @@ -285,14 +287,14 @@ class ClientFeederV3 { null); } - DocumentOperationMessageV3 msg = DocumentOperationMessageV3.create(operation, operationId, metric); - if (msg == null) { + DocumentOperationMessageV3 message = DocumentOperationMessageV3.create(operation, operationId, metric); + if (message == null) { // typical end of feed return null; } metric.add(MetricNames.NUM_OPERATIONS, 1, null /*metricContext*/); - log(LogLevel.DEBUG, "Successfully deserialized document id: ", msg.getOperationId()); - return msg; + log(LogLevel.DEBUG, "Successfully deserialized document id: ", message.getOperationId()); + return message; } private void setMessageParameters(DocumentOperationMessageV3 msg, FeederSettings settings) { diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java index 2424ce596a3..9d6c8c2feac 100755 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java @@ -17,11 +17,9 @@ import com.yahoo.feedapi.FeedContext; import com.yahoo.feedapi.MessagePropertyProcessor; import com.yahoo.messagebus.Message; import com.yahoo.messagebus.routing.Route; -import com.yahoo.prelude.templates.SearchRendererAdaptor; import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.Searcher; -import com.yahoo.search.rendering.RendererRegistry; import com.yahoo.search.result.Hit; import com.yahoo.search.result.HitGroup; import com.yahoo.search.searchchain.Execution; @@ -740,7 +738,7 @@ public class GetSearcherTestCase { assertEquals("application/octet-stream", result.getTemplating().getTemplates().getMimeType()); ByteArrayOutputStream stream = new ByteArrayOutputStream(); - SearchRendererAdaptor.callRender(stream, result); + com.yahoo.prelude.templates.SearchRendererAdaptor.callRender(stream, result); stream.flush(); byte[] resultBytes = stream.toByteArray(); @@ -769,7 +767,7 @@ public class GetSearcherTestCase { assertEquals("text/fancy", result.getTemplating().getTemplates().getMimeType()); ByteArrayOutputStream stream = new ByteArrayOutputStream(); - SearchRendererAdaptor.callRender(stream, result); + com.yahoo.prelude.templates.SearchRendererAdaptor.callRender(stream, result); stream.flush(); byte[] resultBytes = stream.toByteArray(); |