public class SimilarDocumentPrefix extends NodeVisitor implements PrefixHandler
PrefixHandler.ErrorBehaviour, PrefixHandler.NoHooks, PrefixHandler.Phase
Modifier and Type | Field and Description |
---|---|
protected QueryContext |
context |
protected long |
cut |
protected RelatedTermsDictionaryLookup |
dictionary |
protected java.lang.String |
dictionaryName |
protected java.lang.String |
dictionaryPath |
protected java.lang.String |
keywordField |
protected org.apache.log4j.Logger |
log |
protected long |
minNumberOfKeywordPerDoc |
protected int |
minNumberOfMatchedKeywords |
protected RelatedTermsDictResource |
resource |
protected long |
scale |
protected java.lang.String |
virtualField |
Constructor and Description |
---|
SimilarDocumentPrefix(UQLConfig uqlConfig,
java.lang.String virtualField,
long minNumberOfMatchedKeywords,
long minNumberOfKeywordPerDoc,
double similarityThreshold,
java.lang.String keywordField,
java.lang.String dictionaryName,
java.lang.String dictionaryPath) |
Modifier and Type | Method and Description |
---|---|
Node |
handlePrefix(PrefixHandler.Phase phase,
PrefixNode node,
NodeVisitor parentVisitor,
QueryContext queryContext)
Handle a given prefix node.
|
protected long |
keywordScore(long freq,
long maxFreq) |
protected void |
loadDictionary(java.lang.String path) |
void |
onDeinit()
Called when this instance of the prefix handler is deinitialized.
|
void |
onInit(PrefixHandlerContext context)
Called when this instance of the prefix handler is initialized.
|
void |
onQuery(QueryContext context)
Called when a query is about to be processed.
|
void |
setErrorBehaviour(PrefixHandler.ErrorBehaviour behaviour)
Choose the error behaviour of the prefix handler.
|
protected java.lang.String |
virtualFieldExpression(double upperBound) |
Node |
visit(UserQueryChunk node) |
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitNary, visitUnary
protected java.lang.String dictionaryName
protected final long scale
protected RelatedTermsDictionaryLookup dictionary
protected RelatedTermsDictResource resource
protected java.lang.String dictionaryPath
protected int minNumberOfMatchedKeywords
protected long minNumberOfKeywordPerDoc
protected long cut
protected java.lang.String virtualField
protected java.lang.String keywordField
protected QueryContext context
protected org.apache.log4j.Logger log
public SimilarDocumentPrefix(UQLConfig uqlConfig, java.lang.String virtualField, long minNumberOfMatchedKeywords, long minNumberOfKeywordPerDoc, double similarityThreshold, java.lang.String keywordField, java.lang.String dictionaryName, java.lang.String dictionaryPath)
public Node handlePrefix(PrefixHandler.Phase phase, PrefixNode node, NodeVisitor parentVisitor, QueryContext queryContext) throws QueryProcessingException
PrefixHandler
handlePrefix
in interface PrefixHandler
phase
- the "Phase" of the prefix handler, indicating how far in
the pipeline we are.In the standard chain, 4 phases are defined:
PRE_LINGUISTIC, PRE_TRANSFORM, PRE_MAP, POST_MAPnode
- The prefix node to handleparentVisitor
- If your handler is not "terminal", ie, if it
supports nesting, it should call this visitor to visit the prefix
node's content, additionally to performing its work. Warning: this
can be null, in that case, you must not delegate.queryContext
- access to overridable query-related parametersQueryProcessingException
protected void loadDictionary(java.lang.String path) throws ResourceNotFoundException, ResourceAllocationFailedException
public Node visit(UserQueryChunk node)
visit
in class NodeVisitor
public void setErrorBehaviour(PrefixHandler.ErrorBehaviour behaviour)
PrefixHandler
setErrorBehaviour
in interface PrefixHandler
protected long keywordScore(long freq, long maxFreq)
protected java.lang.String virtualFieldExpression(double upperBound)
public void onInit(PrefixHandlerContext context)
PrefixHandler
onInit
in interface PrefixHandler
public void onDeinit()
PrefixHandler
onDeinit
in interface PrefixHandler
public void onQuery(QueryContext context) throws QueryProcessingException
PrefixHandler
onQuery
in interface PrefixHandler
QueryProcessingException
Copyright © 2013 Dassault Systèmes, All Rights Reserved.