Class Evaluation
java.lang.Object
com.yahoo.prelude.semantics.engine.Evaluation
An evaluation of a query over a rule base. There is one evaluation for each evaluation
of one query over one rule base.
- Author:
- bratseth
-
Constructor Summary
ConstructorDescriptionEvaluation
(Query query, RuleBase ruleBase) Evaluation
(Query query, RuleBase ruleBase, int traceLevel) Creates a new evaluation -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an item to the query being evaluated in a way consistent with the query typeReturns the current item, or null if there is no more elementsReturns a fresh rule evaluation starting at the current position of thisgetNameSpace
(String nameSpaceName) getQuery()
int
boolean
Returns whether stemmed matches are allowed.int
The amount of context information to collect about this evaluation.void
void
insertItems
(List<Item> items, CompositeItem parent, int index, TermType desiredParentType, boolean replacing) Inserts an item to the query being evaluated in a way consistent with the query typevoid
makeParentMutable
(TermItem item) Convert The parent of this item into a mutable item.void
next()
Advances to the next item as current itemvoid
previous()
void
removeItem
(int position, Item item) Removes an item, prefers the one at/close to the given position if there are multiple onesvoid
removeItem
(Item item) Removes this itemvoid
removeItemByIdentity
(Item item) Removes this item by identity to ensure we remove the right one if there are multiple equal itemsvoid
reset()
Resets the item iterator to point to the first itemvoid
Resets the item iterator to point to the last item:ruleBase()
Returns the rule base this evaluates overvoid
setStemming
(boolean stemming) Set to true to enable stemmed matches.void
Sets the item iterator to point to the last item:void
void
-
Constructor Details
-
Evaluation
-
Evaluation
Creates a new evaluation- Parameters:
query
- the query this evaluation is fortraceLevel
- the amount of tracing to do
-
-
Method Details
-
ruleBase
Returns the rule base this evaluates over -
reset
public void reset()Resets the item iterator to point to the first item -
setToLast
public void setToLast()Sets the item iterator to point to the last item: -
resetToLast
public void resetToLast()Resets the item iterator to point to the last item: -
getQuery
-
setStemming
public void setStemming(boolean stemming) Set to true to enable stemmed matches. True by default -
getStemming
public boolean getStemming()Returns whether stemmed matches are allowed. True by default -
getQuerySize
public int getQuerySize() -
next
public void next()Advances to the next item as current item -
previous
public void previous() -
currentItem
Returns the current item, or null if there is no more elements -
freshRuleEvaluation
Returns a fresh rule evaluation starting at the current position of this -
addItem
Adds an item to the query being evaluated in a way consistent with the query type -
removeItem
Removes this item -
removeItemByIdentity
Removes this item by identity to ensure we remove the right one if there are multiple equal items -
removeItem
Removes an item, prefers the one at/close to the given position if there are multiple ones -
makeParentMutable
Convert The parent of this item into a mutable item. Note, this may change the shape of the query tree. (E.g. if the original parent is a segment phrase, and the original parent's parent is a phrase, the terms from the parent will be moved to the parent's parent.)- Parameters:
item
- the item for which the parent shall be made mutable
-
insertItems
public void insertItems(List<Item> items, CompositeItem parent, int index, TermType desiredParentType, boolean replacing) Inserts an item to the query being evaluated in a way consistent with the query type- Parameters:
items
- the items to insertparent
- the parent of these items, or null to set the rootindex
- the index at which to insert these into the parentdesiredParentType
- the desired type of the composite which contains items when this returns
-
trace
-
getTraceLevel
public int getTraceLevel()The amount of context information to collect about this evaluation. 0 (the default) means no context information, higher numbers means more context information. -
indentTrace
public void indentTrace() -
unindentTrace
public void unindentTrace() -
getNameSpace
-