Class IndexSegmentSearcher
java.lang.Object
org.apache.cassandra.index.sai.disk.v1.segment.IndexSegmentSearcher
- All Implemented Interfaces:
Closeable,AutoCloseable,SegmentOrdering
- Direct Known Subclasses:
LiteralIndexSegmentSearcher,NumericIndexSegmentSearcher,VectorIndexSegmentSearcher
Abstract reader for individual segments of an on-disk index.
Accepts shared resources (token/offset file readers), and uses them to perform lookups against on-disk data structures.
-
Method Summary
Modifier and TypeMethodDescriptionabstract longstatic IndexSegmentSearcheropen(PrimaryKeyMap.Factory primaryKeyMapFactory, SSTableId sstableId, PerColumnIndexFiles indexFiles, SegmentMetadata segmentMetadata, StorageAttachedIndex index) orderBy(Expression orderer, AbstractBounds<PartitionPosition> keyRange, QueryContext context) Order the rows by the given expression.abstract KeyRangeIteratorsearch(Expression expression, AbstractBounds<PartitionPosition> keyRange, QueryContext queryContext) Search on-disk index synchronously.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.index.sai.disk.v1.segment.SegmentOrdering
orderResultsBy
-
Method Details
-
open
public static IndexSegmentSearcher open(PrimaryKeyMap.Factory primaryKeyMapFactory, SSTableId sstableId, PerColumnIndexFiles indexFiles, SegmentMetadata segmentMetadata, StorageAttachedIndex index) throws IOException - Throws:
IOException
-
indexFileCacheSize
public abstract long indexFileCacheSize()- Returns:
- memory usage of underlying on-disk data structure
-
search
public abstract KeyRangeIterator search(Expression expression, AbstractBounds<PartitionPosition> keyRange, QueryContext queryContext) throws IOException Search on-disk index synchronously.- Parameters:
expression- to filter on disk indexqueryContext- to track per sstable cache and per query metrics- Returns:
KeyRangeIteratorwith matches for the given expression- Throws:
IOException
-
orderBy
public CloseableIterator<PrimaryKeyWithScore> orderBy(Expression orderer, AbstractBounds<PartitionPosition> keyRange, QueryContext context) throws IOException Order the rows by the given expression.- Parameters:
orderer- the object containing the ordering logickeyRange- key range specific in read command, used by ANN indexcontext- to track per sstable cache and per query metrics- Returns:
- an iterator of
PrimaryKeyWithScorein descending score order - Throws:
IOException
-