public class LegacyCombinator extends Searcher
A searcher which grabs query parameters of the form "defidx.(identifier)=(index name)" and "query.(identifier)=(user query)", parses them and adds them as AND items to the query root.
If the given default index does not exist in the search definition, the query part will be parsed with the settings of the default index set to "".
If any of the following arguments exist, they will be used:
query.(identifier)=query string
query.(identifier).operator={"req", "rank", "not"}, where "req" is default
query.(identifier).defidx=default index
query.(identifier).type={"all", "any", "phrase", "adv", "web"} where "all" is
default
If both defidx.(identifier) and any of query.(identifier).{operator,defidx,type} is present in the query, an InvalidQueryParameter error will be added, and the query will be passed through untransformed.
Modifier and Type | Class and Description |
---|---|
private static class |
LegacyCombinator.Combinator |
private static class |
LegacyCombinator.QueryPart |
Modifier and Type | Field and Description |
---|---|
private static String |
DEFIDXPREFIX |
private static String |
DEFIDXSUFFIX |
private static String |
OPERATORSUFFIX |
private static String |
QUERYPREFIX |
private static String |
TYPESUFFIX |
Constructor and Description |
---|
LegacyCombinator() |
Modifier and Type | Method and Description |
---|---|
private static void |
addAndItem(QueryTree queryTree,
Item item) |
private void |
addAndItems(com.yahoo.language.Language language,
Query query,
Iterable<LegacyCombinator.QueryPart> pieces,
IndexFacts.Session session,
Execution.Context context) |
private void |
addNotItem(QueryTree queryTree,
Item item) |
private void |
addNotItems(com.yahoo.language.Language language,
Query query,
Set<LegacyCombinator.QueryPart> pieces,
IndexFacts.Session session,
Execution.Context context) |
private void |
addRankItem(QueryTree queryTree,
Item item) |
private void |
addRankItems(com.yahoo.language.Language language,
Query query,
Set<LegacyCombinator.QueryPart> pieces,
IndexFacts.Session session,
Execution.Context context) |
private static void |
assignDefaultIndex(Item item,
String defaultIndex) |
private String |
defaultIndex(IndexFacts.Session indexFacts,
LegacyCombinator.QueryPart part) |
private static Set<LegacyCombinator.QueryPart> |
findQuerySnippets(Properties properties) |
private static boolean |
hasDots(String name) |
private Item |
parse(com.yahoo.language.Language language,
Query query,
LegacyCombinator.QueryPart part,
String defaultIndex,
Execution.Context context) |
Result |
search(Query query,
Execution execution)
Override this to implement your searcher.
|
private void |
setDefaultIndex(LegacyCombinator.QueryPart part,
String defaultIndex,
Item item) |
ensureFilled, fill, getLogger, process, toString
getAnnotatedDependencies, getDefaultAnnotatedDependencies, getDependencies, initDependencies
private static final String TYPESUFFIX
private static final String OPERATORSUFFIX
private static final String DEFIDXSUFFIX
private static final String DEFIDXPREFIX
private static final String QUERYPREFIX
public Result search(Query query, Execution execution)
Searcher
Searcher implementation subclasses will, depending on their type of logic, do one of the following:
Hits come in two kinds - concrete hits are actual content of the kind requested by the user, meta hits are hits which provides information about the collection of hits, on the query, the service and so on.
The query specifies a window into a larger result list that must be returned from the searcher through hits and offset; Searchers which returns list of hits in the top level in the result must return at least hits number of hits (or if impossible; all that are available), starting at the given offset. In addition, searchers are allowed to return any number of meta hits (although this number is expected to be low). For hits contained in nested hit groups, the concept of a window defined by hits and offset is not well defined and does not apply.
Error handling in searchers:
private void addNotItems(com.yahoo.language.Language language, Query query, Set<LegacyCombinator.QueryPart> pieces, IndexFacts.Session session, Execution.Context context)
private void addRankItems(com.yahoo.language.Language language, Query query, Set<LegacyCombinator.QueryPart> pieces, IndexFacts.Session session, Execution.Context context)
private void addAndItems(com.yahoo.language.Language language, Query query, Iterable<LegacyCombinator.QueryPart> pieces, IndexFacts.Session session, Execution.Context context)
private void setDefaultIndex(LegacyCombinator.QueryPart part, String defaultIndex, Item item)
private Item parse(com.yahoo.language.Language language, Query query, LegacyCombinator.QueryPart part, String defaultIndex, Execution.Context context)
private String defaultIndex(IndexFacts.Session indexFacts, LegacyCombinator.QueryPart part)
private static Set<LegacyCombinator.QueryPart> findQuerySnippets(Properties properties)
private static boolean hasDots(String name)
Copyright © 2018. All rights reserved.