public class GenericExpansionRewriter extends QueryRewriteSearcher
Modifier and Type | Field and Description |
---|---|
static String |
GENERIC_EXPAND_DICT |
static String |
GENERIC_EXPAND_DICT_FILENAME |
static String |
REWRITER_NAME |
rewriterDicts
Constructor and Description |
---|
GenericExpansionRewriter(com.yahoo.component.ComponentId id,
com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer,
RewritesConfig config)
Constructor for GenericExpansionRewriter.
|
GenericExpansionRewriter(RewritesConfig config,
HashMap<String,File> fileList)
Constructor for GenericExpansionRewriter unit test.
|
Modifier and Type | Method and Description |
---|---|
boolean |
configure(com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer,
RewritesConfig config,
HashMap<String,File> fileList)
Instance creation time config loading besides FSA.
|
HashMap<String,String> |
getDefaultFSAs()
Get default FSA dictionary names
|
String |
getRewriterName()
Get the name of the rewriter
|
boolean |
getSkipRewriterIfRewritten()
Get the flag which specifies whether this rewriter
should be skipped if the query has been rewritten
|
HashMap<String,Object> |
rewrite(Query query,
String dictKey)
Main logic of rewriter
- Retrieve rewrites from FSA dict - rewrite query using features that are enabled by user |
getQPConfig, getRewriteFromFSA, search
ensureFilled, fill, getLogger, process, toString
getAnnotatedDependencies, getDefaultAnnotatedDependencies, getDependencies, initDependencies
public static final String REWRITER_NAME
public static final String GENERIC_EXPAND_DICT
public static final String GENERIC_EXPAND_DICT_FILENAME
@Inject public GenericExpansionRewriter(com.yahoo.component.ComponentId id, com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer, RewritesConfig config)
public GenericExpansionRewriter(RewritesConfig config, HashMap<String,File> fileList)
public boolean configure(com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer, RewritesConfig config, HashMap<String,File> fileList)
configure
in class QueryRewriteSearcher
fileAcquirer
- Required param for retrieving file type config
(see vespa's search container doc for more detail)config
- Config from vespa-services.xml (see vespa's search
container doc for more detail)fileList
- pairs of file name and file handler for unit testspublic HashMap<String,Object> rewrite(Query query, String dictKey) throws RuntimeException
rewrite
in class QueryRewriteSearcher
query
- Query object from searcherdictKey
- the key passed from previous rewriter
to be treated as "original query from user"
For example, if previous is misspell rewriter,
it would pass the corrected query as the
"original query from user". For other rewriters which
add variants, abbr, etc to the query, the original
query should be passed as a key. This rewriter could
still choose to ignore this key. This key
is not the rewritten query itself. For example,
if original query is (willl smith) and the
rewritten query is (willl smith) OR (will smith)
the key to be passed could be (will smith)RuntimeException
public boolean getSkipRewriterIfRewritten()
getSkipRewriterIfRewritten
in class QueryRewriteSearcher
public String getRewriterName()
getRewriterName
in class QueryRewriteSearcher
public HashMap<String,String> getDefaultFSAs()
getDefaultFSAs
in class QueryRewriteSearcher
Copyright © 2018. All rights reserved.