Class TextScan
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.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.
-
-
Constructor Summary
Constructors Constructor Description TextScan(Index index, ScanComparisons groupingComparisons, Comparisons.TextComparison textComparison, ScanComparisons suffixComparisons)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
createsDuplicates()
Determines whether this scan might return duplicate results for the same record.boolean
equals(Object o)
ScanComparisons
getGroupingComparisons()
Get any grouping comparisons necessary to scan only within one grouping key.Index
getIndex()
Get the index being scanned.ScanComparisons
getSuffixComparisons()
Get any comparisons performed on fields of the index following the text field.Comparisons.TextComparison
getTextComparison()
Get the comparison performed on the text field.int
hashCode()
int
planHash()
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.<M extends Message>
RecordCursor<IndexEntry>scan(FDBRecordStoreBase<M> store, EvaluationContext context, byte[] continuation, ScanProperties scanProperties)
Scan the store to produce a cursor of index entries that all satisfy the comparison.String
toString()
-
-
-
Constructor Detail
-
TextScan
public TextScan(@Nonnull Index index, @Nullable ScanComparisons groupingComparisons, @Nonnull Comparisons.TextComparison textComparison, @Nullable ScanComparisons suffixComparisons)
-
-
Method Detail
-
scan
@Nonnull public <M extends Message> RecordCursor<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 querycontext
- the query evaluation contextcontinuation
- a continuation from a previous scan to resume query executionscanProperties
- 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 returnnull
or an emptyScanComparisons
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 returnnull
or an emptyScanComparisons
object.- Returns:
- any scan comparisons performed after the text predicate is satisfied
-
planHash
public int planHash()
Description copied from interface:PlanHashable
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.- Specified by:
planHash
in interfacePlanHashable
- Returns:
- a stable hash code
-
-