Class TextScan

  • All Implemented Interfaces:
    PlanHashable

    @API(INTERNAL)
    public class TextScan
    extends Object
    implements PlanHashable
    Encapsulate the information necessary to scan a text-based index. In particular, this includes the work to translate the comparison type into the proper ranges of the index to scan and then combine.

    NOTE: This API is still a work in progress and might change in a future without notice. This class should not be used outside of the Record Layer project.

    • Method Detail

      • scan

        @Nonnull
        public <M extends MessageRecordCursor<IndexEntry> scan​(@Nonnull
                                                                 FDBRecordStoreBase<M> store,
                                                                 @Nonnull
                                                                 EvaluationContext context,
                                                                 @Nullable
                                                                 byte[] continuation,
                                                                 @Nonnull
                                                                 ScanProperties scanProperties)
        Scan the store to produce a cursor of index entries that all satisfy the comparison.
        Type Parameters:
        M - message type associated with the store and evaluation context
        Parameters:
        store - the record store for the query
        context - the query evaluation context
        continuation - a continuation from a previous scan to resume query execution
        scanProperties - execution properties of this scan
        Returns:
        a cursor of index entries from the given scan
      • createsDuplicates

        public boolean createsDuplicates()
        Determines whether this scan might return duplicate results for the same record. This can happen if this is a prefix scan (as the same prefix might correspond to multiple tokens in the same document) or if the index expression itself creates duplicates.
        Returns:
        true if this scan might return multiple entries for the same record
      • getIndex

        @Nonnull
        public Index getIndex()
        Get the index being scanned.
        Returns:
        the index being scanned
      • getGroupingComparisons

        @Nullable
        public ScanComparisons getGroupingComparisons()
        Get any grouping comparisons necessary to scan only within one grouping key. These comparisons should evaluate to "all of" a given tuple range. If the index does not have any grouping keys, this might return null or an empty ScanComparisons object.
        Returns:
        the scan comparisons necessary to scan over the value of one grouping key
      • getTextComparison

        @Nonnull
        public Comparisons.TextComparison getTextComparison()
        Get the comparison performed on the text field. This will be some operation like checking the field for the presence of one or more tokens. This might end up producing multiple scans when run that are executed in parallel and combined.
        Returns:
        the comparison performed on the index's text field
      • getSuffixComparisons

        @Nullable
        public ScanComparisons getSuffixComparisons()
        Get any comparisons performed on fields of the index following the text field. This could be done to satisfy additional predicates on those fields after the text predicate itself is satisfied. If there are no such comparisons, then this might return null or an empty ScanComparisons object.
        Returns:
        any scan comparisons performed after the text predicate is satisfied
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • planHash

        public int planHash​(@Nonnull
                            PlanHashable.PlanHashKind hashKind)
        Description copied from interface: PlanHashable
        Return a hash similar to hashCode, but with the additional guarantee that is is stable across JVMs.
        Specified by:
        planHash in interface PlanHashable
        Parameters:
        hashKind - the "kind" of hash to calculate. Each kind of hash has a particular logic with regards to included and excluded items.
        Returns:
        a stable hash code