diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo')
17 files changed, 62 insertions, 31 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/MultipleResultsSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/MultipleResultsSearcher.java index c47af9e32da..3b2fd596cfa 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/MultipleResultsSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/MultipleResultsSearcher.java @@ -17,7 +17,7 @@ import java.util.*; * * <p> For each group, the desired number of hits can be specified. </p> * - * @author tonytv + * @author tonytv */ public class MultipleResultsSearcher extends Searcher { diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/PosSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/PosSearcher.java index 33667349397..43717ecf6cd 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/PosSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/PosSearcher.java @@ -34,6 +34,7 @@ import com.yahoo.prelude.Location; @Before(PhaseNames.TRANSFORMED_QUERY) @Provides(PosSearcher.POSITION_PARSING) public class PosSearcher extends Searcher { + public static final String POSITION_PARSING = "PositionParsing"; private static final CompoundName posBb = new CompoundName("pos.bb"); @@ -52,7 +53,7 @@ public class PosSearcher extends Searcher { public final static double km2deg = 1000.000 * 180.0 / (Math.PI * 6356752.0); public final static double mi2deg = 1609.344 * 180.0 / (Math.PI * 6356752.0); - + @Override public Result search(Query query, Execution execution) { String bb = query.properties().getString(posBb); String ll = query.properties().getString(posLl); @@ -92,9 +93,8 @@ public class PosSearcher extends Searcher { } } catch (IllegalArgumentException e) { - // System.err.println("error: "+e); - return new Result(query, ErrorMessage.createInvalidQueryParameter( - "Error in pos parameters: " + Exceptions.toMessageString(e))); + return new Result(query, ErrorMessage.createInvalidQueryParameter("Error in pos parameters: " + + Exceptions.toMessageString(e))); } // and finally: query.getRanking().setLocation(loc); @@ -102,8 +102,8 @@ public class PosSearcher extends Searcher { } private void handleGeoCircle(Query query, String ll, Location target) { - double ewCoord = 0; - double nsCoord = 0; + double ewCoord; + double nsCoord; try { DegreesParser parsed = new DegreesParser(ll); ewCoord = parsed.longitude; @@ -111,9 +111,9 @@ public class PosSearcher extends Searcher { } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unable to parse lat/long string '" +ll + "'", e); } - String radius = query.properties().getString(posRadius); - double radiusdegrees = 0.0; + String radius = query.properties().getString(posRadius); + double radiusdegrees; if (radius == null) { radiusdegrees = 50.0 * km2deg; } else if (radius.endsWith("km")) { @@ -133,8 +133,8 @@ public class PosSearcher extends Searcher { private void handleXyCircle(Query query, String xy, Location target) { - int xcoord = 0; - int ycoord = 0; + int xcoord; + int ycoord; // parse xy int semipos = xy.indexOf(';'); if (semipos > 0 && semipos < xy.length()) { @@ -143,8 +143,9 @@ public class PosSearcher extends Searcher { } else { throw new IllegalArgumentException("pos.xy must be in the format 'digits;digits' but was: '"+xy+"'"); } + String radius = query.properties().getString(posRadius); - int radiusUnits = 0; + int radiusUnits; if (radius == null) { radiusUnits = 5000; } else if (radius.endsWith("km")) { @@ -165,7 +166,6 @@ public class PosSearcher extends Searcher { target.setXyCircle(xcoord, ycoord, radiusUnits); } - private static void parseBoundingBox(String bb, Location target) { BoundingBoxParser parser = new BoundingBoxParser(bb); target.setBoundingBox(parser.n, parser.s, parser.e, parser.w); 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 index 81b948682df..32efcde6feb 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/QuerySnapshotSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/QuerySnapshotSearcher.java @@ -11,19 +11,20 @@ import com.yahoo.search.searchchain.Execution; /** * 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 + * @deprecated do not use */ - +@Deprecated // TODO: Remove on Vespa 7 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)); + 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 index 4e604dcd226..558521a7a8d 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/QueryValidatingSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/QueryValidatingSearcher.java @@ -10,8 +10,10 @@ import com.yahoo.search.searchchain.Execution; /** * Ensures hits is 1000 or less and offset is 1000 or less. * - * @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 QueryValidatingSearcher extends Searcher { public Result search(Query query, Execution execution) { diff --git a/container-search/src/main/java/com/yahoo/prelude/searcher/ValidatePredicateSearcher.java b/container-search/src/main/java/com/yahoo/prelude/searcher/ValidatePredicateSearcher.java index 2e2c73b6707..9b6f5926b61 100644 --- a/container-search/src/main/java/com/yahoo/prelude/searcher/ValidatePredicateSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/searcher/ValidatePredicateSearcher.java @@ -20,7 +20,7 @@ import java.util.Collection; /** * Checks that predicate queries don't use values outside the defined upper/lower bounds. * - * @author <a href="mailto:magnarn@yahoo-inc.com">Magnar Nedland</a> + * @author Magnar Nedland */ @After(BooleanSearcher.PREDICATE) public class ValidatePredicateSearcher extends Searcher { @@ -78,4 +78,5 @@ public class ValidatePredicateSearcher extends Searcher { @Override public void onExit() {} } + } diff --git a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java index 9de1a5e2a2d..bd61de7f783 100644 --- a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java @@ -10,6 +10,7 @@ import com.yahoo.log.LogLevel; import com.yahoo.metrics.simple.MetricSettings; import com.yahoo.metrics.simple.MetricReceiver; import com.yahoo.processing.request.CompoundName; +import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.Searcher; import com.yahoo.search.result.Coverage; @@ -207,7 +208,8 @@ public class StatisticsSearcher extends Searcher { * 2) Add response time to total response time (time from entry to return) * 3) ..... */ - public Result search(com.yahoo.search.Query query, Execution execution) { + @Override + public Result search(Query query, Execution execution) { if (query.properties().getBoolean(IGNORE_QUERY,false)) { return execution.search(query); } diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/Context.java b/container-search/src/main/java/com/yahoo/prelude/templates/Context.java index 7a904ea014c..7989f35e77b 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/Context.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/Context.java @@ -9,7 +9,10 @@ import com.yahoo.text.XML; * A set of variable bindings for template rendering * * @author bratseth + * @deprecated use a Renderer instead */ +@SuppressWarnings("deprecation") +@Deprecated // TODO: Remove on Vespa 7 public abstract class Context { private boolean xmlEscape = true; diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/FormattingOptions.java b/container-search/src/main/java/com/yahoo/prelude/templates/FormattingOptions.java index f14d8ddf319..dab80580f61 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/FormattingOptions.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/FormattingOptions.java @@ -13,7 +13,10 @@ import java.util.Set; * Defines formatting options used with special kinds of hits. * * @author laboisse + * @deprecated use a Renderer instead */ +@SuppressWarnings("deprecation") +@Deprecated // TODO: Remove on Vespa 7 public class FormattingOptions { public static final String DEFAULT_TYPE_ATTRIBUTE_NAME = "type"; diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/HitContext.java b/container-search/src/main/java/com/yahoo/prelude/templates/HitContext.java index 037d1a77d5c..4d1daa97306 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/HitContext.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/HitContext.java @@ -17,7 +17,10 @@ import java.util.Set; * A context providing all the fields of a hit, and falls back to MapContext behavior for all other keys. * * @author tonytv + * @deprecated use a Renderer instead */ +@SuppressWarnings("deprecation") +@Deprecated // TODO: Remove on Vespa 7 public class HitContext extends Context { private final Hit hit; diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/MapContext.java b/container-search/src/main/java/com/yahoo/prelude/templates/MapContext.java index 49c5ffa6e78..84d97b71f60 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/MapContext.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/MapContext.java @@ -6,7 +6,12 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -/** A context having a map as secondary storage */ +/** + * A context having a map as secondary storage + * @deprecated use a Renderer instead + */ +@SuppressWarnings("deprecation") +@Deprecated // TODO: Remove on Vespa 7 public class MapContext extends Context { private Map<String, Object> map = new LinkedHashMap<>(); diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/PageTemplateSet.java b/container-search/src/main/java/com/yahoo/prelude/templates/PageTemplateSet.java index a24fd623e4d..83118ec66ad 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/PageTemplateSet.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/PageTemplateSet.java @@ -14,7 +14,10 @@ import java.io.Writer; * This is a variant of the tiled template set - see that class for details. * * @author bratseth + * @deprecated use a Renderer instead */ +@SuppressWarnings("deprecation") +@Deprecated // TODO: Remove on Vespa 7 public class PageTemplateSet extends TiledTemplateSet { public PageTemplateSet() { diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/SearchRendererAdaptor.java b/container-search/src/main/java/com/yahoo/prelude/templates/SearchRendererAdaptor.java index 31e133d22d5..a639a6b97ec 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/SearchRendererAdaptor.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/SearchRendererAdaptor.java @@ -21,8 +21,10 @@ import java.util.Iterator; * Renders a search result using the old templates API. * * @author tonytv + * @deprecated do not use */ @SuppressWarnings({ "rawtypes", "deprecation", "unchecked" }) +@Deprecated // TODO: Remove on Vespa 7 public final class SearchRendererAdaptor extends Renderer { private final LogExceptionUserTemplateDelegator templates; diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/Template.java b/container-search/src/main/java/com/yahoo/prelude/templates/Template.java index 63bd3214b17..3d00be9d05b 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/Template.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/Template.java @@ -10,7 +10,10 @@ import java.io.Writer; * template mechanism by subclassing this. * * @author bratseth + * @deprecated use a Renderer instead */ +@SuppressWarnings("deprecation") +@Deprecated // TODO: Remove on Vespa 7 public abstract class Template<T extends Writer> { /** @@ -19,8 +22,7 @@ public abstract class Template<T extends Writer> { * @param context the context to evaluate in * @param writer the writer to render to */ - public abstract void render(Context context,T writer) - throws java.io.IOException; + public abstract void render(Context context,T writer) throws java.io.IOException; /** diff --git a/container-search/src/main/java/com/yahoo/prelude/templates/TiledTemplateSet.java b/container-search/src/main/java/com/yahoo/prelude/templates/TiledTemplateSet.java index 6bba0f620ee..91bc33e3e2a 100644 --- a/container-search/src/main/java/com/yahoo/prelude/templates/TiledTemplateSet.java +++ b/container-search/src/main/java/com/yahoo/prelude/templates/TiledTemplateSet.java @@ -70,7 +70,10 @@ import java.util.stream.Collectors; * * @author bratseth * @author laboisse + * @deprecated use a Renderer instead */ +@SuppressWarnings("deprecation") +@Deprecated // TODO: Remove on Vespa 7 public class TiledTemplateSet extends DefaultTemplateSet { private FormattingOptions hitOptionsForProvider; diff --git a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java index 1c6e92ebffc..e9e4e34727c 100644 --- a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java +++ b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java @@ -230,7 +230,7 @@ public class SearchHandler extends LoggingRequestHandler { return (e.getCause() instanceof IllegalArgumentException) ? invalidParameterResponse(request, e) : illegalQueryResponse(request, e); - } catch (RuntimeException e) { // Make sure we generate a valid XML response even on unexpected errors + } catch (RuntimeException e) { // Make sure we generate a valid response even on unexpected errors log.log(Level.WARNING, "Failed handling " + request, e); return internalServerErrorResponse(request, e); } diff --git a/container-search/src/main/java/com/yahoo/search/result/Templating.java b/container-search/src/main/java/com/yahoo/search/result/Templating.java index 47f40f3c7f5..9e191a1219c 100644 --- a/container-search/src/main/java/com/yahoo/search/result/Templating.java +++ b/container-search/src/main/java/com/yahoo/search/result/Templating.java @@ -15,8 +15,10 @@ import com.yahoo.search.query.Presentation; * Helper methods and data store for result attributes geared towards result * rendering and presentation. * - * @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 Templating { private final Result result; diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java b/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java index 56a6a702962..f4973ba4239 100644 --- a/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java @@ -28,7 +28,7 @@ import com.yahoo.search.searchchain.Execution; * 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 + * @author bratseth */ public class DocumentSourceSearcher extends Searcher { @@ -85,7 +85,6 @@ public class DocumentSourceSearcher extends Searcher { private void addDefaultResults() { Query q = new Query("?query=default"); Result r = new Result(q); - // These four used to assign collapseId 1,2,3,4 - re-add that if needed r.hits().add(new Hit("http://default-1.html", 0)); r.hits().add(new Hit("http://default-2.html", 0)); r.hits().add(new Hit("http://default-3.html", 0)); @@ -97,8 +96,7 @@ public class DocumentSourceSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { queryCount++; - Result r; - r = unFilledResults.get(getQueryKeyClone(query)); + Result r = unFilledResults.get(getQueryKeyClone(query)); if (r == null) { r = defaultFilledResult.clone(); } else { @@ -111,12 +109,13 @@ 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 sourcr, 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(); + Query key = query.clone(); key.setWindow(0,0); + key.getModel().setSources(""); return key; } |