public class NameRewriter extends QueryRewriteSearcher
Modifier and Type | Field and Description |
---|---|
private Logger |
logger |
static String |
NAME_ENTITY_EXPAND_DICT |
static String |
NAME_ENTITY_EXPAND_DICT_FILENAME |
static String |
REWRITER_NAME |
private boolean |
SKIP_REWRITER_IF_REWRITTEN |
rewriterDicts
Constructor and Description |
---|
NameRewriter(com.yahoo.component.ComponentId id,
com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer,
RewritesConfig config)
Constructor for NameRewriter
Load configs using default format |
NameRewriter(RewritesConfig config,
HashMap<String,File> fileList)
Constructor for NameRewriter unit test
Load configs using default format |
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
Empty for this rewriter |
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.
|
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
private final boolean SKIP_REWRITER_IF_REWRITTEN
public static final String REWRITER_NAME
public static final String NAME_ENTITY_EXPAND_DICT
public static final String NAME_ENTITY_EXPAND_DICT_FILENAME
private Logger logger
@Inject public NameRewriter(com.yahoo.component.ComponentId id, com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer, RewritesConfig config)
public NameRewriter(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.