summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-11-05 11:09:51 +0100
committergjoranv <gv@oath.com>2019-01-21 15:09:25 +0100
commitcfc7c2bc1aaddbe183bdc5f73bff433070d602da (patch)
tree46b69dcced0d07de43aa4b2dc8d7571e19346b0b /container-search
parent3c5531d7cb6557bfea6dc6f1f0d77b96a0569b54 (diff)
Remove deprecated code
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/IndexFacts.java83
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/Pong.java2
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java22
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/logging/AccessLogEntry.java18
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/logging/package-info.java5
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java2
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/querytransform/IndexCombinatorSearcher.java361
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/searcher/DocumentSourceSearcher.java225
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/searcher/JuniperSearcher.java2
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/searcher/QuerySnapshotSearcher.java31
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/searcher/QueryValidatingSearcher.java38
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java3
-rw-r--r--container-search/src/main/java/com/yahoo/search/Query.java27
-rw-r--r--container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java7
-rw-r--r--container-search/src/main/java/com/yahoo/search/grouping/GroupingRequest.java29
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/Model.java52
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/Presentation.java10
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java6
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/Coverage.java14
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java12
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/ErrorHit.java9
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/Hit.java166
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/HitGroup.java11
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java5
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/searcher/test/QuerySnapshotSearcherTestCase.java52
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/searcher/test/QueryValidatingSearcherTestCase.java81
26 files changed, 13 insertions, 1260 deletions
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 448d8e7855f..2fcd2466dd8 100644
--- a/container-search/src/main/java/com/yahoo/prelude/IndexFacts.java
+++ b/container-search/src/main/java/com/yahoo/prelude/IndexFacts.java
@@ -44,12 +44,8 @@ public class IndexFacts {
/**
* The name of the default search definition, which is the union of all
* known document types.
- *
- * @deprecated do not use
*/
- // TODO: Make this package private in Vespa 7
- @Deprecated // OK
- public static final String unionName = "unionOfAllKnown";
+ static final String unionName = "unionOfAllKnown";
/** A search definition which contains the union of all settings. */
@SuppressWarnings("deprecation")
@@ -106,31 +102,6 @@ public class IndexFacts {
return clusters != null ? clusters : Collections.<String>emptyList();
}
- /**
- * Public only for testing.
- *
- * @deprecated set at creation time
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void setClusters(Map<String, List<String>> clusters) {
- ensureNotFrozen();
- this.clusters = clusters;
- clusterByDocument = invert(clusters);
- }
-
- /**
- * @deprecated set indexes at creation time instead
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void setSearchDefinitions(Map<String, SearchDefinition> searchDefinitions,
- SearchDefinition unionSearchDefinition) {
- ensureNotFrozen();
- this.searchDefinitions = searchDefinitions;
- this.unionSearchDefinition = unionSearchDefinition;
- }
-
private boolean isInitialized() {
return searchDefinitions.size() > 0;
}
@@ -312,58 +283,6 @@ public class IndexFacts {
}
}
-
- /**
- * Add a string to be accepted as an index name when parsing a
- * query.
- *
- * For testing only.
- *
- * @param sdName name of search definition containing index, if null, modify default set
- * @param indexName name of index, actual or otherwise
- * @deprecated set indexes at creation time instead
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void addIndex(String sdName, String indexName) {
- ensureNotFrozen();
-
- SearchDefinition sd;
- if (sdName == null) {
- sd = unionSearchDefinition;
- } else if (searchDefinitions.containsKey(sdName)) {
- sd = searchDefinitions.get(sdName);
- } else {
- sd = new SearchDefinition(sdName);
- searchDefinitions.put(sdName, sd);
- }
- sd.getOrCreateIndex(indexName);
- unionSearchDefinition.getOrCreateIndex(indexName);
- }
-
- /**
- * Adds an index to the specified index, and the default index settings,
- * overriding any current settings for this index
- * @deprecated set indexes at creation time instead
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void addIndex(String sdName, Index index) {
- ensureNotFrozen();
-
- SearchDefinition sd;
- if (sdName == null) {
- sd = unionSearchDefinition;
- } else if (searchDefinitions.containsKey(sdName)) {
- sd = searchDefinitions.get(sdName);
- } else {
- sd = new SearchDefinition(sdName);
- searchDefinitions.put(sdName, sd);
- }
- sd.addIndex(index);
- unionSearchDefinition.addIndex(index);
- }
-
public String getDefaultPosition(String sdName) {
SearchDefinition sd;
if (sdName == null) {
diff --git a/container-search/src/main/java/com/yahoo/prelude/Pong.java b/container-search/src/main/java/com/yahoo/prelude/Pong.java
index ba3ff2eda00..cef64c293af 100644
--- a/container-search/src/main/java/com/yahoo/prelude/Pong.java
+++ b/container-search/src/main/java/com/yahoo/prelude/Pong.java
@@ -46,7 +46,7 @@ public class Pong {
public int getErrorSize() {
return errors.size();
}
-
+
/** Returns the number of active documents in the backend responding in this Pong, if available */
public Optional<Long> activeDocuments() {
if ( ! pongPacket.isPresent()) return Optional.empty();
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 e9442aaf615..d9246bbc757 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
@@ -315,21 +315,6 @@ public class FastHit extends Hit {
return super.hasFields();
}
- /**
- * Changes the key under which a value is found. This is useful because it allows keys to be changed
- * without accessing the value (which may be lazily created).
- *
- * @deprecated do not use
- */
- @Deprecated // OK
- @Override
- @SuppressWarnings("deprecation")
- public void changeFieldKey(String oldKey, String newKey) {
- Object value = removeField(oldKey);
- if (value != null)
- setField(newKey, value);
- }
-
private Object getSummaryValue(String name) {
if (removedFields != null && removedFields.contains(name))
return null;
@@ -357,13 +342,6 @@ public class FastHit extends Hit {
}
}
- /** @deprecated do not use */
- // TODO: Make private on Vespa 7
- @Deprecated // OK
- public static String asHexString(GlobalId gid) {
- return asHexString(new StringBuilder(), gid).toString();
- }
-
private static StringBuilder asHexString(StringBuilder sb, GlobalId gid) {
byte[] rawGid = gid.getRawId();
for (byte b : rawGid) {
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
deleted file mode 100644
index f9faf242350..00000000000
--- a/container-search/src/main/java/com/yahoo/prelude/logging/AccessLogEntry.java
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.logging;
-
-/**
- * Hollow compatibility class for com.yahoo.container.logging.AccessLogEntry.
- *
- * @author Steinar Knutsen
- * @deprecated do not use
- */
-// TODO: Remove on Vespa 7
-@Deprecated // OK
-public class AccessLogEntry extends com.yahoo.container.logging.AccessLogEntry {
-
- public AccessLogEntry() {
- super();
- }
-
-}
diff --git a/container-search/src/main/java/com/yahoo/prelude/logging/package-info.java b/container-search/src/main/java/com/yahoo/prelude/logging/package-info.java
deleted file mode 100644
index 01126ec3484..00000000000
--- a/container-search/src/main/java/com/yahoo/prelude/logging/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-@ExportPackage
-package com.yahoo.prelude.logging;
-
-import com.yahoo.osgi.annotation.ExportPackage;
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java
index f6f96ae215c..244d895f357 100644
--- a/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java
+++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java
@@ -13,7 +13,7 @@ import static com.yahoo.prelude.query.parser.Token.Kind.NUMBER;
* @author Steinar Knutsen
* @deprecated since 5.11, YQL+ should be used for formal queries
*/
-@Deprecated // OK DO NOT REMOVE (we'll keep this around longer)
+@Deprecated // DO NOT REMOVE (we'll keep this around longer)
public class AdvancedParser extends StructuredParser {
public AdvancedParser(ParserEnvironment environment) {
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
deleted file mode 100644
index ff603a64725..00000000000
--- a/container-search/src/main/java/com/yahoo/prelude/querytransform/IndexCombinatorSearcher.java
+++ /dev/null
@@ -1,361 +0,0 @@
-// 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 static com.yahoo.prelude.querytransform.PhrasingSearcher.PHRASE_REPLACEMENT;
-
-import com.yahoo.component.chain.dependencies.After;
-import com.yahoo.component.chain.dependencies.Before;
-import com.yahoo.component.chain.dependencies.Provides;
-import com.yahoo.log.LogLevel;
-import com.yahoo.prelude.Index;
-import com.yahoo.prelude.Index.Attribute;
-import com.yahoo.prelude.IndexFacts;
-import com.yahoo.prelude.query.*;
-import com.yahoo.search.Query;
-import com.yahoo.search.Result;
-import com.yahoo.search.Searcher;
-import com.yahoo.search.searchchain.Execution;
-import com.yahoo.search.searchchain.PhaseNames;
-
-import java.util.*;
-
-/**
- * Searcher to rewrite queries to achieve mixed recall between indices and
- * memory attributes.
- *
- * @author Steinar Knutsen
- * @deprecated do not use
- */
-// TODO: Remove on Vespa 7 (not necessary any more)
-@After({PhaseNames.RAW_QUERY, PHRASE_REPLACEMENT})
-@Before(PhaseNames.TRANSFORMED_QUERY)
-@Provides(IndexCombinatorSearcher.MIXED_RECALL_REWRITE)
-@Deprecated // OK
-public class IndexCombinatorSearcher extends Searcher {
-
- public static final String MIXED_RECALL_REWRITE = "MixedRecallRewrite";
-
- private static class ArrayComparator implements Comparator<Attribute[]> {
- /**
- * Note, this ignores if there is a difference in whether to
- * attributes have tokenized content. (If this is the case,
- * we are having worse problems anyway.)
- */
- public int compare(Attribute[] o1, Attribute[] o2 ) {
- if (o1.length < o2.length) {
- return -1;
- } else if (o1.length > o2.length) {
- return 1;
- }
- int limit = o1.length;
- for (int i = 0; i < limit; ++i) {
- int r = o1[i].name.compareTo(o2[i].name);
- if (r != 0) {
- return r;
- }
- }
- return 0;
- }
- }
-
- private final ArrayComparator comparator = new ArrayComparator();
-
- private enum RewriteStrategies {
- NONE, CHEAP_AND, EXPENSIVE_AND, FLAT
- }
-
- @Override
- public Result search(Query query, Execution execution) {
- Item root = query.getModel().getQueryTree().getRoot();
- IndexFacts.Session session = execution.context().getIndexFacts().newSession(query);
- String oldQuery = (query.getTraceLevel() >= 2) ? root.toString() : "";
-
- if (root instanceof BlockItem || root instanceof PhraseItem) {
- root = convertSinglePhraseOrBlock(root, session);
- } else if (root instanceof CompositeItem) {
- root = rewrite((CompositeItem) root, session);
- }
- query.getModel().getQueryTree().setRoot(root);
-
- if ((query.getTraceLevel() >= 2) && !(oldQuery.equals(root.toString()))) {
- query.trace("Rewriting for mixed recall between indices and attributes", true, 2);
- }
- return execution.search(query);
- }
-
- private RewriteStrategies chooseRewriteStrategy(CompositeItem c, IndexFacts.Session session) {
- if (c instanceof OrItem) {
- return RewriteStrategies.FLAT;
- } else if (!(c instanceof AndItem)) {
- return RewriteStrategies.NONE;
- }
- Map<Attribute[], Integer> m = new TreeMap<>(comparator);
- for (Iterator<Item> i = c.getItemIterator(); i.hasNext();) {
- Item j = i.next();
- if (j instanceof BlockItem || j instanceof PhraseItem) {
- Attribute[] attributes= getIndices((HasIndexItem) j, session);
- if (attributes == null) {
- continue;
- }
- Integer count = m.get(attributes);
- if (count == null) {
- count = 1;
- } else {
- count = count.intValue() + 1;
- }
- m.put(attributes, count);
- }
- }
-
- if (m.size() == 0) {
- return RewriteStrategies.NONE;
- }
-
- int singles = 0;
- int pairs = 0;
- int higher = 0;
- // count the number of sets being associated with 1, 2 or more terms
- for (Integer i : m.values()) {
- switch (i.intValue()) {
- case 1:
- ++singles;
- break;
- case 2:
- pairs += 2;
- break;
- default:
- ++higher;
- break;
- }
- }
- if (higher == 0 && pairs + singles <= 2) {
- return RewriteStrategies.EXPENSIVE_AND;
- } else {
- return RewriteStrategies.CHEAP_AND;
- }
- }
-
- private CompositeItem rewriteNot(NotItem not, IndexFacts.Session session) {
- Item positive = not.getItem(0);
- if (positive instanceof BlockItem || positive instanceof PhraseItem) {
- positive = convertSinglePhraseOrBlock(positive, session);
- not.setItem(0, positive);
- } else if (positive instanceof CompositeItem) {
- CompositeItem c = (CompositeItem) positive;
- positive = rewrite(c, session);
- not.setItem(0, positive);
- }
-
- int length = not.getItemCount();
- // no need for keeping proximity in the negative branches, so we
- // convert them one by one, _and_ always uses cheap transform
- for (int i = 1; i < length; ++i) {
- Item exclusion = not.getItem(i);
- if (exclusion instanceof BlockItem || exclusion instanceof PhraseItem) {
- exclusion = convertSinglePhraseOrBlock(exclusion, session);
- not.setItem(i, exclusion);
- } else if (exclusion instanceof CompositeItem) {
- CompositeItem c = (CompositeItem) exclusion;
- switch (chooseRewriteStrategy(c, session)) {
- case NONE:
- c = traverse(c, session);
- break;
- case CHEAP_AND:
- case EXPENSIVE_AND:
- c = cheapTransform(c, session);
- break;
- default:
- c = flatTransform(c, session);
- break;
- }
- not.setItem(i, c);
- }
- }
- return not;
- }
-
- private Item rewrite(CompositeItem c, IndexFacts.Session session) {
- if (c instanceof NotItem) {
- c = rewriteNot((NotItem) c, session);
- return c;
- } else {
- switch (chooseRewriteStrategy(c, session)) {
- case NONE:
- c = traverse(c, session);
- break;
- case CHEAP_AND:
- c = cheapTransform(c, session);
- break;
- case EXPENSIVE_AND:
- c = expensiveTransform((AndItem) c, session);
- break;
- case FLAT:
- c = flatTransform(c, session);
- break;
- default:
- break;
- }
- }
- return c;
- }
-
- private CompositeItem traverse(CompositeItem c, IndexFacts.Session session) {
- int length = c.getItemCount();
- for (int i = 0; i < length; ++i) {
- Item word = c.getItem(i);
- if (word instanceof CompositeItem && !(word instanceof PhraseItem) && !(word instanceof BlockItem)) {
- c.setItem(i, rewrite((CompositeItem) word, session));
- }
- }
- return c;
- }
-
- private CompositeItem expensiveTransform(AndItem c, IndexFacts.Session session) {
- int[] indices = new int[2];
- int items = 0;
- int length = c.getItemCount();
- Attribute[][] names = new Attribute[2][];
- CompositeItem result = null;
- for (int i = 0; i < length; ++i) {
- Item word = c.getItem(i);
- if (word instanceof BlockItem || word instanceof PhraseItem) {
- Attribute[] attributes = getIndices((HasIndexItem) word, session);
- if (attributes == null) {
- continue;
- }
- // this throwing an out of bounds if more than two candidates is intentional
- names[items] = attributes;
- indices[items++] = i;
- } else if (word instanceof CompositeItem) {
- c.setItem(i, rewrite((CompositeItem) word, session));
- }
- }
- switch (items) {
- case 1:
- result = linearAnd(c, names[0], indices[0]);
- break;
- case 2:
- result = quadraticAnd(c, names[0], names[1], indices[0], indices[1]);
- break;
- default:
- // should never happen
- getLogger().log(
- LogLevel.WARNING,
- "Unexpected number of items for mixed recall, got " + items
- + ", expected 1 or 2.");
- break;
- }
- return result;
- }
-
- private Attribute[] getIndices(HasIndexItem block, IndexFacts.Session session) {
- return session.getIndex(block.getIndexName()).getMatchGroup();
- }
-
- private OrItem linearAnd(AndItem c, Attribute[] names, int brancherIndex) {
- OrItem or = new OrItem();
- for (int i = 0; i < names.length; ++i) {
- AndItem duck = (AndItem) c.clone();
- Item b = retarget(duck.getItem(brancherIndex), names[i]);
- duck.setItem(brancherIndex, b);
- or.addItem(duck);
- }
- return or;
- }
-
- private OrItem quadraticAnd(AndItem c, Attribute[] firstNames, Attribute[] secondNames, int firstBrancher, int secondBrancher) {
- OrItem or = new OrItem();
- for (int i = 0; i < firstNames.length; ++i) {
- for (int j = 0; j < secondNames.length; ++j) {
- AndItem duck = (AndItem) c.clone();
- Item b = retarget(duck.getItem(firstBrancher), firstNames[i]);
- duck.setItem(firstBrancher, b);
- b = retarget(duck.getItem(secondBrancher), secondNames[j]);
- duck.setItem(secondBrancher, b);
- or.addItem(duck);
- }
- }
- return or;
- }
-
- private CompositeItem flatTransform(CompositeItem c, IndexFacts.Session session) {
- int maxIndex = c.getItemCount() - 1;
- for (int i = maxIndex; i >= 0; --i) {
- Item word = c.getItem(i);
- if (word instanceof BlockItem || word instanceof PhraseItem) {
- Attribute[] attributes = getIndices((HasIndexItem) word, session);
- if (attributes == null) {
- continue;
- }
- c.removeItem(i);
- for (Attribute name : attributes) {
- Item term = word.clone();
- Item forNewIndex = retarget(term, name);
- c.addItem(forNewIndex);
- }
- } else if (word instanceof CompositeItem) {
- c.setItem(i, rewrite((CompositeItem) word, session));
- }
- }
- return c;
- }
-
- private CompositeItem cheapTransform(CompositeItem c, IndexFacts.Session session) {
- if (c instanceof OrItem) {
- return flatTransform(c, session);
- }
- int length = c.getItemCount();
- for (int i = 0; i < length; ++i) {
- Item j = c.getItem(i);
- if (j instanceof BlockItem || j instanceof PhraseItem) {
- Attribute[] attributes = getIndices((HasIndexItem) j, session);
- if (attributes == null) {
- continue;
- }
- CompositeItem or = searchAllForItem(j, attributes);
- c.setItem(i, or);
- } else if (j instanceof CompositeItem) {
- c.setItem(i, rewrite((CompositeItem) j, session));
- }
- }
- return c;
- }
-
- private OrItem searchAllForItem(Item word, Attribute[] attributes) {
- OrItem or = new OrItem();
- for (Attribute name : attributes) {
- Item term = word.clone();
- term = retarget(term, name);
- or.addItem(term);
- }
- return or;
- }
-
- private Item retarget(Item word, Attribute newIndex) {
- if (word instanceof PhraseItem && !newIndex.isTokenizedContent()) {
- PhraseItem asPhrase = (PhraseItem) word;
- WordItem newWord = new WordItem(asPhrase.getIndexedString(), newIndex.name, false);
- return newWord;
- } else if (word instanceof IndexedItem) {
- word.setIndexName(newIndex.name);
- } else if (word instanceof CompositeItem) {
- CompositeItem asComposite = (CompositeItem) word;
- for (Iterator<Item> i = asComposite.getItemIterator(); i.hasNext();) {
- Item segment = i.next();
- segment.setIndexName(newIndex.name);
- }
- }
- return word;
- }
-
- private Item convertSinglePhraseOrBlock(Item item, IndexFacts.Session session) {
- Item newItem;
- Attribute[] attributes = getIndices((HasIndexItem) item, session);
- if (attributes == null) {
- return item;
- }
- newItem = searchAllForItem(item, attributes);
- return newItem;
- }
-
-}
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
deleted file mode 100644
index bc3c6665ae2..00000000000
--- a/container-search/src/main/java/com/yahoo/prelude/searcher/DocumentSourceSearcher.java
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.searcher;
-
-import com.yahoo.search.Query;
-import com.yahoo.search.Result;
-import com.yahoo.search.Searcher;
-import com.yahoo.search.result.Hit;
-import com.yahoo.search.searchchain.Execution;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * <p>Implements a document source. You pass in a query and a Result
- * set. When this Searcher is called with that query it will return
- * that result set.</p>
- *
- * <p>This supports multi-phase search.</p>
- *
- * <p>To avoid having to add type information for the fields, a quck hack is used to
- * support testing of attribute prefetching.
- * Any field in the configured hits which has a name starting by attribute
- * will be returned when attribute prefetch filling is requested.</p>
- *
- * @author bratseth
- * @deprecated use {@link com.yahoo.search.searchchain.testutil.DocumentSourceSearcher}
- */
-@SuppressWarnings({"rawtypes"})
-// TODO: Remove on Vespa 7
-@Deprecated // OK
-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...
-
- private Result defaultFilledResult;
- private Map<Query, Result> completelyFilledResults = new HashMap<>();
- private Map<Query, Result> attributeFilledResults = new HashMap<>();
- private Map<Query, Result> unFilledResults = new HashMap<>();
-
- /** Time (in ms) at which the index of this searcher was last modified */
- long editionTimeStamp=0;
-
- private int queryCount;
-
- public DocumentSourceSearcher() {
- addDefaultResults();
- }
-
- /**
- * Adds a result which can be returned either as empty,
- * filled or attribute only filled later.
- * Summary fields starting by "a" are attributes, others are not.
- *
- * @return true when replacing an existing &lt;query, result&gt; pair.
- */
- public boolean addResultSet(Query query, Result fullResult) {
- Result emptyResult = new Result(query.clone());
- Result attributeResult = new Result(query.clone());
- emptyResult.setTotalHitCount(fullResult.getTotalHitCount());
- attributeResult.setTotalHitCount(fullResult.getTotalHitCount());
- int counter=0;
- for (Iterator i = fullResult.hits().deepIterator();i.hasNext();) {
- Hit fullHit = (Hit)i.next();
-
- Hit emptyHit = fullHit.clone();
- emptyHit.clearFields();
- emptyHit.setFillable();
- emptyHit.setRelevance(fullHit.getRelevance());
-
- Hit attributeHit = fullHit.clone();
- removePropertiesNotStartingByA(attributeHit);
- attributeHit.setFillable();
- attributeHit.setRelevance(fullHit.getRelevance());
- for (Object propertyKeyObject : fullHit.fields().keySet()) {
- String propertyKey=propertyKeyObject.toString();
- if (propertyKey.startsWith("attribute"))
- attributeHit.setField(propertyKey, fullHit.getField(propertyKey));
- }
- if (fullHit.getField(Hit.SDDOCNAME_FIELD)!=null)
- attributeHit.setField(Hit.SDDOCNAME_FIELD, fullHit.getField(Hit.SDDOCNAME_FIELD));
-
- // A simple summary lookup mechanism, similar to FastSearch's
- emptyHit.setField("summaryid", String.valueOf(counter));
- attributeHit.setField("summaryid", String.valueOf(counter));
- fullHit.setField("summaryid", String.valueOf(counter));
-
- counter++;
- emptyResult.hits().add(emptyHit);
- attributeResult.hits().add(attributeHit);
- }
- unFilledResults.put(getQueryKeyClone(query), emptyResult);
- attributeFilledResults.put(getQueryKeyClone(query), attributeResult);
- if (completelyFilledResults.put(getQueryKeyClone(query), fullResult.clone()) != null) {
- setEditionTimeStamp(System.currentTimeMillis());
- return true;
- }
- return false;
- }
-
- /**
- * 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 Query getQueryKeyClone(Query query) {
- Query key = query.clone();
- key.setWindow(0,0);
- key.getModel().setSources("");
- return key;
- }
-
- private void removePropertiesNotStartingByA(Hit hit) {
- List<String> toRemove=new java.util.ArrayList<>();
- for (Iterator i= ((Set) hit.fields().keySet()).iterator(); i.hasNext(); ) {
- String key=(String)i.next();
- if (!key.startsWith("a"))
- toRemove.add(key);
- }
- for (Iterator<String> i=toRemove.iterator(); i.hasNext(); ) {
- String propertyName=i.next();
- hit.removeField(propertyName);
- }
- }
-
- private void addDefaultResults() {
- Query q = new Query("?query=default");
- Result r = new Result(q);
- r.hits().add(new Hit("http://default-1.html"));
- r.hits().add(new Hit("http://default-2.html"));
- r.hits().add(new Hit("http://default-3.html"));
- r.hits().add(new Hit("http://default-4.html"));
- defaultFilledResult = r;
- addResultSet(q, r);
- }
-
- public long getEditionTimeStamp(){
- long myEditionTime;
- synchronized(this){
- myEditionTime=this.editionTimeStamp;
- }
- return myEditionTime;
- }
-
- public void setEditionTimeStamp(long editionTime) {
- synchronized(this){
- this.editionTimeStamp=editionTime;
- }
- }
-
- public Result search(com.yahoo.search.Query query, Execution execution) {
- queryCount++;
- Result r;
- r = unFilledResults.get(getQueryKeyClone(query));
- if (r == null) {
- r = defaultFilledResult.clone();
- } else {
- r = r.clone();
- }
- r.setQuery(query);
- r.hits().trim(query.getOffset(), query.getHits());
- return r;
- }
-
- @Override
- public void fill(com.yahoo.search.Result result, String summaryClass, Execution execution) {
- Result filledResult;
- if ("attributeprefetch".equals(summaryClass))
- filledResult=attributeFilledResults.get(getQueryKeyClone(result.getQuery()));
- else
- filledResult = completelyFilledResults.get(getQueryKeyClone(result.getQuery()));
-
- if (filledResult == null) {
- filledResult = defaultFilledResult;
- }
- fillHits(filledResult,result,summaryClass);
- }
-
- private void fillHits(Result source,Result target,String summaryClass) {
- for (Iterator hitsToFill= target.hits().deepIterator() ; hitsToFill.hasNext();) {
- Hit hitToFill = (Hit) hitsToFill.next();
- String summaryId= (String) hitToFill.getField("summaryid");
- if (summaryId==null) continue; // Can not fill this
- Hit filledHit = lookupBySummaryId(source,summaryId);
- if (filledHit==null)
- throw new RuntimeException("Can't fill hit with summaryid '" + summaryId + "', not present");
-
- for (Iterator props= filledHit.fieldIterator();props.hasNext();) {
- Map.Entry propertyEntry = (Map.Entry)props.next();
- hitToFill.setField(propertyEntry.getKey().toString(),
- propertyEntry.getValue());
- }
- hitToFill.setFilled(summaryClass);
- }
- target.analyzeHits();
- }
-
- private Hit lookupBySummaryId(Result result,String summaryId) {
- for (Iterator i= result.hits().deepIterator(); i.hasNext(); ) {
- Hit hit=(Hit)i.next();
- if (summaryId.equals(hit.getField("summaryid"))) {
- return hit;
- }
- }
- return null;
- }
-
- /**
- * Returns the number of queries made to this searcher since the last
- * reset. For testing - not reliable if multiple threads makes
- * queries simultaneously
- */
- public int getQueryCount() {
- return queryCount;
- }
-
- public void resetQueryCount() {
- queryCount=0;
- }
-
-}
diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/JuniperSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/JuniperSearcher.java
index 5c56379efc0..521ea83f712 100644
--- a/container-search/src/main/java/com/yahoo/prelude/searcher/JuniperSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/searcher/JuniperSearcher.java
@@ -108,7 +108,7 @@ public class JuniperSearcher extends Searcher {
for (Index index : indexFacts.getIndexes(searchDefinitionField.toString())) {
if (index.getDynamicSummary() || index.getHighlightSummary()) {
- HitField fieldValue = hit.buildHitField(index.getName(), true, true);
+ HitField fieldValue = hit.buildHitField(index.getName(), true);
if (fieldValue != null)
insertTags(fieldValue, bolding, index.getDynamicSummary());
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/QuerySnapshotSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/QuerySnapshotSearcher.java
deleted file mode 100644
index 4edb907d337..00000000000
--- a/container-search/src/main/java/com/yahoo/prelude/searcher/QuerySnapshotSearcher.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.searcher;
-
-import com.yahoo.search.result.Hit;
-import com.yahoo.search.result.Relevance;
-import com.yahoo.search.Query;
-import com.yahoo.search.Result;
-import com.yahoo.search.Searcher;
-import com.yahoo.search.searchchain.Execution;
-
-/**
- * Save the query in the incoming state to a meta hit in the result.
- *
- * @author Steinar Knutsen
- * @deprecated do not use
- */
-// TODO: Remove on Vespa 7
-@Deprecated // OK
-public class QuerySnapshotSearcher extends Searcher {
-
- public Result search(Query query, Execution execution) {
- Query q = query.clone();
- Result r = execution.search(query);
- Hit h = new Hit("meta:querysnapshot", new Relevance(Double.POSITIVE_INFINITY));
- h.setMeta(true);
- h.setField("query", q);
- r.hits().add(h);
- return r;
- }
-
-}
diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/QueryValidatingSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/QueryValidatingSearcher.java
deleted file mode 100644
index fd155354d1c..00000000000
--- a/container-search/src/main/java/com/yahoo/prelude/searcher/QueryValidatingSearcher.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.searcher;
-
-import com.yahoo.search.result.ErrorMessage;
-import com.yahoo.search.Query;
-import com.yahoo.search.Result;
-import com.yahoo.search.Searcher;
-import com.yahoo.search.searchchain.Execution;
-
-/**
- * Ensures hits is 1000 or less and offset is 1000 or less.
- *
- * @author Steinar Knutsen
- * @deprecated do not use
- */
-// TODO: Remove on Vespa 7
-@Deprecated // OK
-public class QueryValidatingSearcher extends Searcher {
-
- public Result search(Query query, Execution execution) {
- if (query.getHits() > 1000) {
- Result result = new Result(query);
- ErrorMessage error
- = ErrorMessage.createInvalidQueryParameter("Too many hits (more than 1000) requested.");
- result.hits().addError(error);
- return result;
- }
- if (query.getOffset() > 1000) {
- Result result = new Result(query);
- ErrorMessage error
- = ErrorMessage.createInvalidQueryParameter("Offset too high (above 1000).");
- result.hits().addError(error);
- return result;
- }
- return execution.search(query);
- }
-
-}
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java b/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java
index 89849f98461..4d46107726e 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/SemanticSearcher.java
@@ -15,7 +15,6 @@ import com.yahoo.search.searchchain.PhaseNames;
import java.util.*;
-import static com.yahoo.prelude.querytransform.IndexCombinatorSearcher.MIXED_RECALL_REWRITE;
import static com.yahoo.prelude.querytransform.StemmingSearcher.STEMMING;
/**
@@ -24,7 +23,7 @@ import static com.yahoo.prelude.querytransform.StemmingSearcher.STEMMING;
* @author bratseth
*/
@After(PhaseNames.RAW_QUERY)
-@Before({PhaseNames.TRANSFORMED_QUERY, STEMMING, MIXED_RECALL_REWRITE})
+@Before({PhaseNames.TRANSFORMED_QUERY, STEMMING})
public class SemanticSearcher extends Searcher {
private static final CompoundName rulesRulebase=new CompoundName("rules.rulebase");
diff --git a/container-search/src/main/java/com/yahoo/search/Query.java b/container-search/src/main/java/com/yahoo/search/Query.java
index e1bfc96dab0..b4adca2cef1 100644
--- a/container-search/src/main/java/com/yahoo/search/Query.java
+++ b/container-search/src/main/java/com/yahoo/search/Query.java
@@ -527,15 +527,6 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
}
/**
- * @deprecated do not use
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public boolean requestHasProperty(String name) {
- return httpRequest.hasProperty(name);
- }
-
- /**
* Returns the number of milliseconds to wait for a response from a search backend
* before timing it out. Default is 500.
* <p>
@@ -639,24 +630,6 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
setHits(hits);
}
- /**
- * This is ignored - compression is controlled at the network level.
- *
- * @deprecated this is ignored
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void setCompress(boolean ignored) { }
-
- /**
- * Returns false.
- *
- * @deprecated this always returns false
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public boolean getCompress() { return false; }
-
/** Returns a string describing this query */
@Override
public String toString() {
diff --git a/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java b/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java
index 5de0c5eff74..ac0c8375f04 100644
--- a/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java
+++ b/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java
@@ -35,13 +35,6 @@ public class ClusterMonitor<T> {
/** A map from Node to corresponding MonitoredNode */
private final Map<T, BaseNodeMonitor<T>> nodeMonitors = Collections.synchronizedMap(new java.util.LinkedHashMap<>());
- /** @deprecated use the constructor with just the first argument instead */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public ClusterMonitor(NodeManager<T> manager, String ignored) {
- this(manager);
- }
-
public ClusterMonitor(NodeManager<T> manager) {
nodeManager = manager;
monitorThread = new MonitorThread("search.clustermonitor");
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/GroupingRequest.java b/container-search/src/main/java/com/yahoo/search/grouping/GroupingRequest.java
index 83eca89dffa..13c23234910 100644
--- a/container-search/src/main/java/com/yahoo/search/grouping/GroupingRequest.java
+++ b/container-search/src/main/java/com/yahoo/search/grouping/GroupingRequest.java
@@ -121,20 +121,6 @@ public class GroupingRequest {
}
/**
- * Sets the result {@link RootGroup} of this request. This is used by the executing grouping searcher, and should
- * not be called by a requesting searcher.
- *
- * @param group the result to set.
- * @return this, to allow chaining.
- * @deprecated this is a noop
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public GroupingRequest setResultGroup(RootGroup group) {
- return this;
- }
-
- /**
* Returns the list of {@link Continuation}s of this request. This is used by the executing grouping searcher to
* allow pagination of grouping results.
*
@@ -156,21 +142,6 @@ public class GroupingRequest {
return newRequest;
}
- /**
- * Returns all instances of this class that have been attached to the given {@link Query}. If no requests have been
- * attached to the {@link Query}, this method returns an empty list.
- *
- * @param query the query whose requests to return.
- * @return the list of grouping requests.
- * @deprecated use query.getSelect().getGrouping()
- */
- @SuppressWarnings({ "unchecked" })
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public static List<GroupingRequest> getRequests(Query query) {
- return query.getSelect().getGrouping();
- }
-
@Override
public String toString() {
return root == null ? "(empty)" : root.toString();
diff --git a/container-search/src/main/java/com/yahoo/search/query/Model.java b/container-search/src/main/java/com/yahoo/search/query/Model.java
index 379d2d85bcc..28b605fa095 100644
--- a/container-search/src/main/java/com/yahoo/search/query/Model.java
+++ b/container-search/src/main/java/com/yahoo/search/query/Model.java
@@ -93,34 +93,6 @@ public class Model implements Cloneable {
setParent(query);
}
- /**
- * Creates trace a message of language detection results into this Model
- * instance's parent query. Do note this will give bogus results if the
- * Execution instance is not set correctly. This is done automatically
- * inside {@link Execution#search(Query)}. If tracing the same place as
- * creating the query instance, {@link #setExecution(Execution)} has to be
- * invoked first with the same Execution instance the query is intended to
- * be run by.
- *
- * @deprecated do not use; language can now be assigned later and for parts of the query tree, making this quite useless
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void traceLanguage() {
- if (getParent().getTraceLevel() < 2) return;
- if (language != null) {
- getParent().trace("Language " + getLanguage() + " specified directly as a parameter", false, 2);
- }
- else {
- Language l = getParsingLanguage();
- // Don't include the query, it will trigger query parsing
- getParent().trace("Detected language: " + l, false, 2);
- getParent().trace("Language " + l + " determined by " +
- (Language.fromEncoding(encoding) != Language.UNKNOWN ? "query encoding" :
- "the characters in the terms") + ".", false, 2);
- }
- }
-
public Language getParsingLanguage() {
return getParsingLanguage(queryString);
}
@@ -535,28 +507,4 @@ public class Model implements Cloneable {
return false;
}
- /**
- * Set the YTrace header value to use when transmitting this model to a
- * search backend (of some kind).
- *
- * @param next string representation of header value
- * @deprecated not used, ytrace has been discontinued
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void setYTraceHeaderToNext(String next) { }
-
- /**
- * Get the YTrace header value to use when transmitting this model to a
- * search backend (of some kind). Returns null if no ytrace data is not
- * turned on.
- *
- * @deprecated not used, ytrace has been discontinued
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public String getYTraceHeaderToNext() {
- return null;
- }
-
}
diff --git a/container-search/src/main/java/com/yahoo/search/query/Presentation.java b/container-search/src/main/java/com/yahoo/search/query/Presentation.java
index ae179a2ba07..7ef4b0728c4 100644
--- a/container-search/src/main/java/com/yahoo/search/query/Presentation.java
+++ b/container-search/src/main/java/com/yahoo/search/query/Presentation.java
@@ -96,16 +96,6 @@ public class Presentation implements Cloneable {
/** Sets whether matching query terms should be bolded in the result */
public void setBolding(boolean bolding) { this.bolding = bolding; }
- /** @deprecated coverage information is always returned */
- @Deprecated // OK
- // TODO: Remove on Vespa 7
- public boolean getReportCoverage() { return true; }
-
- /** @deprecated coverage information is always returned */
- @Deprecated // OK
- // TODO: Remove on Vespa 7
- public void setReportCoverage(boolean ignored) { }
-
/** Get the name of the format desired for result rendering. */
@NonNull
public ComponentSpecification getRenderer() { return format; }
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 9eadd22ed43..b8b85eb4a5d 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
@@ -29,12 +29,6 @@ import java.util.Map;
*/
public class QueryProperties extends Properties {
- /** @deprecated use Query.nativeProperties */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public static final CompoundName[] PER_SOURCE_QUERY_PROPERTIES =
- Query.nativeProperties.toArray(new CompoundName[] {});
-
private Query query;
private final CompiledQueryProfileRegistry profileRegistry;
diff --git a/container-search/src/main/java/com/yahoo/search/result/Coverage.java b/container-search/src/main/java/com/yahoo/search/result/Coverage.java
index 7bc49fdb0b1..25829b70b5e 100644
--- a/container-search/src/main/java/com/yahoo/search/result/Coverage.java
+++ b/container-search/src/main/java/com/yahoo/search/result/Coverage.java
@@ -23,20 +23,6 @@ public class Coverage extends com.yahoo.container.handler.Coverage {
super(docs, active, nodes, resultSets);
}
- // TODO: Remove on Vespa 7
- /** @deprecated don't send a "full" boolean */
- @Deprecated // OK
- public Coverage(long docs, int nodes, boolean full) {
- this(docs, nodes, full, 1);
- }
-
- // TODO: Remove on Vespa 7
- /** @deprecated don't send a "full" boolean */
- @Deprecated // OK
- public Coverage(long docs, int nodes, boolean full, int resultSets) {
- super(docs, nodes, full, resultSets);
- }
-
/**
* Will set number of documents present in ideal state
*
diff --git a/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java b/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java
index 54b83544b1a..d8ec768325a 100644
--- a/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java
+++ b/container-search/src/main/java/com/yahoo/search/result/DefaultErrorHit.java
@@ -58,18 +58,6 @@ public class DefaultErrorHit extends Hit implements ErrorHit, Cloneable {
}
/**
- * Returns the main error of this result, never null.
- *
- * @deprecated use {@link #errors()}
- */
- @Override
- @Deprecated // OK
- // TODO: Remove on Vespa 7
- public ErrorMessage getMainError() {
- return errors.get(0);
- }
-
- /**
* This is basically a way of making a list simulate a set.
*/
private void removeAndAdd(ErrorMessage error) {
diff --git a/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java b/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java
index 091c8d67793..9be80372ba9 100644
--- a/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java
+++ b/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java
@@ -14,15 +14,6 @@ public interface ErrorHit extends Cloneable {
void setSource(String source);
- /**
- * Returns the main error of this result, never null
- *
- * @deprecated use errors().iterator().next()
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- ErrorMessage getMainError();
-
/**
* Adds an error to this. This may change the main error
* and/or the list of detailed errors
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 c5132549d05..fdfa58730fc 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
@@ -478,20 +478,6 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
return fields != null && ! fields.isEmpty();
}
- /**
- * Changes the key under which a value is found. This is useful because it allows keys to be changed
- * without accessing the value (which may be lazily created).
- *
- * @deprecated do not use
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void changeFieldKey(String oldKey, String newKey) {
- Map<String,Object> fieldMap = getFieldMap();
- Object value = fieldMap.remove(oldKey);
- fieldMap.put(newKey, value);
- }
-
private Map<String, Object> getFieldMap() {
return getFieldMap(2);
}
@@ -515,42 +501,16 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
return unmodifiableFieldMap;
}
- /** Generate a HitField from a field if the field exists */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public HitField buildHitField(String key) {
- return buildHitField(key, false);
- }
-
- /** Generate a HitField from a field if the field exists */
- @SuppressWarnings("deprecation")
- // TODO: Remove on Vespa 7
- @Deprecated // OK
public HitField buildHitField(String key, boolean forceNoPreTokenize) {
- return buildHitField(key, forceNoPreTokenize, false);
- }
-
- // TODO: Remove third parameter on Vespa 7 (set always true)
- @Deprecated // OK
- public HitField buildHitField(String key, boolean forceNoPreTokenize, boolean forceStringHandling) {
Object o = getField(key);
if (o == null) return null;
if (o instanceof HitField) return (HitField)o;
HitField h;
- if (forceNoPreTokenize) {
- if (o instanceof XMLString && !forceStringHandling) {
- h = new HitField(key, (XMLString) o, false);
- } else {
- h = new HitField(key, o.toString(), false);
- }
- } else {
- if (o instanceof XMLString && !forceStringHandling) {
- h = new HitField(key, (XMLString) o);
- } else {
- h = new HitField(key, o.toString());
- }
- }
+ if (forceNoPreTokenize)
+ h = new HitField(key, o.toString(), false);
+ else
+ h = new HitField(key, o.toString());
h.setOriginal(o);
getFieldMap().put(key, h);
return h;
@@ -559,34 +519,19 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
/** Returns the types of this as a modifiable set. Modifications to this set are directly reflected in this hit */
public Set<String> types() { return types; }
- /** @deprecated do not use */
- // TODO: FRemove on Vespa 7
- @Deprecated // OK
- public String getTypeString() {
- return types().stream().collect(Collectors.joining(" "));
- }
-
/**
* Returns the add number, assigned when adding the hit to a Result.
*
* Used to order equal relevant hit by add order. -1 if this hit
* has never been added to a result.
- *
- * @deprecated do not use
*/
- // TODO: Make package private on Vespa 7
- @Deprecated // OK
- public int getAddNumber() { return addNumber; }
+ int getAddNumber() { return addNumber; }
/**
* Sets the add number, assigned when adding the hit to a Result,
* used to order equal relevant hit by add order.
- *
- * @deprecated do not use
*/
- // TODO: Make package private on Vespa 7
- @Deprecated // OK
- public void setAddNumber(int addNumber) { this.addNumber = addNumber; }
+ void setAddNumber(int addNumber) { this.addNumber = addNumber; }
/**
* Returns whether this is a concrete hit, containing content of the requested
@@ -610,16 +555,6 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
public void setAuxiliary(boolean auxiliary) { this.auxiliary = auxiliary; }
- /** @deprecated do not use */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public int getSourceNumber() { return sourceNumber; }
-
- /** @deprecated do not use */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void setSourceNumber(int number) { this.sourceNumber = number; }
-
/** Returns the query which produced this hit, or null if not known */
public Query getQuery() { return query; }
@@ -633,52 +568,6 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
}
}
- /**
- * Returns a field of this hit XML escaped and without token
- * delimiters.
- *
- * @deprecated do not use
- * @return a field of this hit, or null if the property is not set
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public String getFieldXML(String key) {
- Object p = getField(key);
-
- if (p == null) {
- return null;
- } else if (p instanceof HitField) {
- return ((HitField)p).quotedContent(false);
- } else if (p instanceof StructuredData || p instanceof XMLString || p instanceof JSONString) {
- return p.toString();
- } else {
- return XML.xmlEscape(p.toString(), false, '\u001f');
- }
- }
-
- /**
- * @deprecated do not use
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public String getUnboldedField(String key, boolean escape) {
- Object p = getField(key);
-
- if (p == null) {
- return null;
- } else if (p instanceof HitField) {
- return ((HitField) p).bareContent(escape, false);
- } else if (p instanceof StructuredData) {
- return p.toString();
- } else if (p instanceof XMLString || p instanceof JSONString) {
- return p.toString();
- } else if (escape) {
- return XML.xmlEscape(p.toString(), false, '\u001f');
- } else {
- return stripCharacter('\u001F', p.toString());
- }
- }
-
/** Attach some data to this hit for this searcher */
public void setSearcherSpecificMetaData(Searcher searcher, Object data) {
if (searcherSpecificMetaData == null) {
@@ -703,60 +592,21 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
return searcherSpecificMetaData != null ? searcherSpecificMetaData.get(searcher) : null;
}
- /**
- * Internal - do not use
- *
- * @param filled the backing set
- */
- // TODO: Make package private on Vespa 7
- protected final void setFilledInternal(Set<String> filled) {
+ final void setFilledInternal(Set<String> filled) {
this.filled = filled;
unmodifiableFilled = (filled != null) ? Collections.unmodifiableSet(filled) : null;
}
/**
- * For internal use only.
* Gives access to the modifiable backing set of filled summaries.
* This set might be unmodifiable if the size is less than or equal to 1
*
* @return the set of filled summaries.
*/
- // TODO: Make package private on Vespa 7
- protected final Set<String> getFilledInternal() {
+ final Set<String> getFilledInternal() {
return filled;
}
- /**
- * @deprecated do not use
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public static String stripCharacter(char strip, String toStripFrom) {
- StringBuilder builder = null;
-
- int lastBadChar = 0;
- for (int i = 0; i < toStripFrom.length(); i++) {
- if (toStripFrom.charAt(i) == strip) {
- if (builder == null) {
- builder = new StringBuilder(toStripFrom.length());
- }
-
- builder.append(toStripFrom, lastBadChar, i);
- lastBadChar = i + 1;
- }
- }
-
- if (builder == null) {
- return toStripFrom;
- } else {
- if (lastBadChar < toStripFrom.length()) {
- builder.append(toStripFrom, lastBadChar, toStripFrom.length());
- }
-
- return builder.toString();
- }
- }
-
/** Releases the resources held by this, making it irreversibly unusable */
protected void close() {
query = null;
diff --git a/container-search/src/main/java/com/yahoo/search/result/HitGroup.java b/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
index 3d5cbab2865..af89220e504 100644
--- a/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
+++ b/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
@@ -383,17 +383,6 @@ public class HitGroup extends Hit implements DataList<Hit>, Cloneable, Iterable<
return hit;
}
- /**
- * Sets the main error of this result
- *
- * @deprecated prefer addError to add some error information.
- */
- // TODO: Remove on Vespa 7
- @Deprecated // OK
- public void setError(ErrorMessage error) {
- addError(error);
- }
-
/** Adds an error to this result */
public void addError(ErrorMessage error) {
getError(); // update the list of errors
diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java
index bf86ca4544b..4875121a501 100644
--- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java
@@ -336,11 +336,6 @@ public class FieldCollapsingSearcherTestCase {
assertHit("http://acme.org/h.html", 6,1,r.hits().get(1));
}
- // This test depends on DocumentSourceSearcher filling the hits
- // with whatever data it got, ignoring actual summary arguments
- // in the fill call, then saying the hits are filled for the
- // ignored argument. Rewrite to contain different summaries if
- // DocumentSourceSearcher gets extended.
@Test
public void testFieldCollapsingTwoPhaseSelectSummary() {
// Set up
diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QuerySnapshotSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/QuerySnapshotSearcherTestCase.java
deleted file mode 100644
index 7b92e2c1a7c..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QuerySnapshotSearcherTestCase.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.searcher.test;
-
-import com.google.common.util.concurrent.MoreExecutors;
-import com.yahoo.component.chain.Chain;
-import com.yahoo.language.simple.SimpleLinguistics;
-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.prelude.searcher.QuerySnapshotSearcher;
-import com.yahoo.search.searchchain.Execution;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author bratseth
- */
-public class QuerySnapshotSearcherTestCase {
-
- @Test
- public void test() {
- Searcher searcher=new QuerySnapshotSearcher();
- Result result = doSearch(searcher, new Query(), 0,10);
- Hit hit=result.hits().get(0);
- assertEquals(String.valueOf(Double.POSITIVE_INFINITY),
- hit.getRelevance().toString());
- }
-
- private Result doSearch(Searcher searcher, Query query, int offset, int hits) {
- query.setOffset(offset);
- query.setHits(hits);
- return createExecution(searcher).search(query);
- }
-
- private Execution createExecution(Searcher searcher) {
- Execution.Context context = new Execution.Context(null, null, null, new RendererRegistry(MoreExecutors.directExecutor()), new SimpleLinguistics());
- return new Execution(chainedAsSearchChain(searcher), context);
- }
-
- private Chain<Searcher> chainedAsSearchChain(Searcher topOfChain) {
- List<Searcher> searchers = new ArrayList<>();
- searchers.add(topOfChain);
- return new Chain<>(searchers);
- }
-
-}
diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QueryValidatingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/QueryValidatingSearcherTestCase.java
deleted file mode 100644
index 3967ac63e36..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QueryValidatingSearcherTestCase.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.searcher.test;
-
-import com.google.common.util.concurrent.MoreExecutors;
-import com.yahoo.component.chain.Chain;
-import com.yahoo.language.simple.SimpleLinguistics;
-import com.yahoo.search.rendering.RendererRegistry;
-import com.yahoo.search.result.Hit;
-import com.yahoo.search.Query;
-import com.yahoo.search.Result;
-import com.yahoo.search.Searcher;
-import com.yahoo.search.searchchain.Execution;
-import com.yahoo.search.searchchain.testutil.DocumentSourceSearcher;
-import com.yahoo.prelude.searcher.QueryValidatingSearcher;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- * Tests correct denial of query.
- *
- * @author Steinar Knutsen
- */
-public class QueryValidatingSearcherTestCase {
-
- @Test
- public void testBasic() {
- // Setup
- Map<Searcher, Searcher> chained = new HashMap<>();
- Query query = new Query("?query=test");
-
- Result result = new Result(query);
- result.hits().add(new Hit("ymail://1111111111/AQAAAP7JgwEAj6XjQQAAAO/+ggA=",950));
-
- Searcher validator = new QueryValidatingSearcher();
- DocumentSourceSearcher source = new DocumentSourceSearcher();
- chained.put(validator, source);
- source.addResult(query, result);
-
- // Exercise
- Result returnedResult = doSearch(validator, query, 0, 10, chained);
-
- // Validate
- assertEquals(1, returnedResult.getHitCount());
- assertNull(returnedResult.hits().getError());
-
- returnedResult = doSearch(validator, query, 0, 1001, chained);
- assertEquals(0, returnedResult.getConcreteHitCount());
- assertEquals(4, returnedResult.hits().getError().getCode());
-
- returnedResult = doSearch(validator, query, 1001, 10, chained);
- assertEquals(0, returnedResult.getConcreteHitCount());
- assertEquals(4, returnedResult.hits().getError().getCode());
- }
-
- private Result doSearch(Searcher searcher, Query query, int offset, int hits, Map<Searcher, Searcher> chained) {
- query.setOffset(offset);
- query.setHits(hits);
- return createExecution(searcher, chained).search(query);
- }
-
- private Chain<Searcher> chainedAsSearchChain(Searcher topOfChain, Map<Searcher, Searcher> chained) {
- List<Searcher> searchers = new ArrayList<>();
- for (Searcher current = topOfChain; current != null; current = chained.get(current)) {
- searchers.add(current);
- }
- return new Chain<>(searchers);
- }
-
- private Execution createExecution(Searcher searcher, Map<Searcher, Searcher> chained) {
- Execution.Context context = new Execution.Context(null, null, null, new RendererRegistry(MoreExecutors.directExecutor()), new SimpleLinguistics());
- return new Execution(chainedAsSearchChain(searcher, chained), context);
- }
-
-}