Class Evaluation
- java.lang.Object
-
- com.yahoo.prelude.semantics.engine.Evaluation
-
public class Evaluation extends Object
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
Constructors Constructor Description Evaluation(Query query)
Evaluation(Query query, int traceLevel)
Creates a new evaluation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addItem(Item item, TermType termType)
Adds an item to the query being evaluated in a way consistent with the query typeFlattenedItem
currentItem()
Returns the current item, or null if there is no more elementsRuleEvaluation
freshRuleEvaluation()
Returns a fresh rule evaluation starting at the current position of thisNameSpace
getNameSpace(String nameSpaceName)
Query
getQuery()
int
getQuerySize()
boolean
getStemming()
Returns whether stemmed matches are allowed.int
getTraceLevel()
The amount of context information to collect about this evaluation.void
indentTrace()
void
insertItem(Item item, CompositeItem parent, int index, TermType desiredParentType)
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
resetToLast()
Resets the item iterator to point to the last item:void
setStemming(boolean stemming)
Set to true to enable stemmed matches.void
setToLast()
Sets the item iterator to point to the last item:void
trace(int level, String message)
void
unindentTrace()
-
-
-
Method Detail
-
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
public Query 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
public FlattenedItem currentItem()
Returns the current item, or null if there is no more elements
-
freshRuleEvaluation
public RuleEvaluation freshRuleEvaluation()
Returns a fresh rule evaluation starting at the current position of this
-
addItem
public void addItem(Item item, TermType termType)
Adds an item to the query being evaluated in a way consistent with the query type
-
removeItem
public void removeItem(Item item)
Removes this item
-
removeItemByIdentity
public void removeItemByIdentity(Item item)
Removes this item by identity to ensure we remove the right one if there are multiple equal items
-
removeItem
public void removeItem(int position, Item item)
Removes an item, prefers the one at/close to the given position if there are multiple ones
-
makeParentMutable
public void makeParentMutable(TermItem item)
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
-
insertItem
public void insertItem(Item item, CompositeItem parent, int index, TermType desiredParentType)
Inserts an item to the query being evaluated in a way consistent with the query type- Parameters:
item
- the item to insertparent
- the parent of this item, or null to set the rootindex
- the index at which to insert this into the parentdesiredParentType
- the desired type of the composite which contains item when this returns
-
trace
public void trace(int level, String message)
-
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()
-
-