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 Details

    • Evaluation

      public Evaluation(Query query, RuleBase ruleBase)
    • Evaluation

      public Evaluation(Query query, RuleBase ruleBase, int traceLevel)
      Creates a new evaluation
      Parameters:
      query - the query this evaluation is for
      traceLevel - the amount of tracing to do
  • Method Details

    • ruleBase

      public RuleBase 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

      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
    • 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 insert
      parent - the parent of these items, or null to set the root
      index - the index at which to insert these into the parent
      desiredParentType - the desired type of the composite which contains items 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()
    • getNameSpace

      public NameSpace getNameSpace(String nameSpaceName)