Class IndexPredicate<I>

All Implemented Interfaces:
Matchable<I>
Direct Known Subclasses:
ChangeIndexPredicate, IntegerRangePredicate, RegexPredicate, TimestampRangePredicate

public abstract class IndexPredicate<I> extends OperatorPredicate<I> implements Matchable<I>
Predicate that is mapped to a field in the index.
  • Constructor Details

  • Method Details

    • getField

      public SchemaFieldDefs.SchemaField<I,?> getField()
    • getType

      public FieldType<?> getType()
    • match

      public boolean match(I doc)
      This method matches documents without calling an index subsystem. For primitive fields (e.g. integer, long) , the matching logic is consistent across this method and all known index implementations. For text fields (i.e. prefix and full-text) the semantics vary between this implementation and known index implementations:
    • Prefix: Lucene as well as match(Object) matches terms as true prefixes (prefix:foo -> `foo bar` matches, but `baz foo bar` does not match). The index implementation at Google tokenizes both the query and the indexed text and matches tokens individually (prefix:fo ba -> `baz foo bar` matches).
    • Full text: Lucene uses a PhraseQuery to search for terms in full text fields in-order. The index implementation at Google as well as match(Object) tokenizes both the query and the indexed text and matches tokens individually.
    • Specified by:
      match in interface Matchable<I>
      Returns:
      true if the predicate matches the provided I.
    • getCost

      public int getCost()
      Description copied from interface: Matchable
      Returns a cost estimate to run this predicate, higher figures cost more.
      Specified by:
      getCost in interface Matchable<I>