@Beta public class PredicateIndex extends Object
Predicate
objects.
Use a PredicateQuery
to find the ids of documents that have matching Predicates.
Create an instance of PredicateIndex
using the PredicateIndexBuilder
.
To build a PredicateQuery
you add features and rangeFeatures with a 64-bit
bitmap specifying which subqueries they appear in.
To perform a search, create a PredicateIndex.Searcher
and call its PredicateIndex.Searcher.search(PredicateQuery)
method, which returns a stream of Hit
objects,
each of which contains a document id and a 64-bit bitmap specifying which subqueries the hit is for.
Note that the PredicateIndex
is thread-safe, but a PredicateIndex.Searcher
is not.
Each thread must use its own searcher.
Modifier and Type | Class and Description |
---|---|
class |
PredicateIndex.Searcher |
Modifier and Type | Field and Description |
---|---|
private com.yahoo.search.predicate.index.SimpleIndex |
boundsIndex |
private Config |
config |
private com.yahoo.search.predicate.index.conjunction.ConjunctionIndex |
conjunctionIndex |
private com.yahoo.search.predicate.index.SimpleIndex |
conjunctionIntervalIndex |
private com.yahoo.search.predicate.index.PredicateRangeTermExpander |
expander |
private int |
highestIntervalEnd |
private int[] |
internalToExternalIdMapping |
private short[] |
intervalEnds |
private com.yahoo.search.predicate.index.SimpleIndex |
intervalIndex |
private com.yahoo.search.predicate.index.PredicateIntervalStore |
intervalStore |
private byte[] |
minFeatureIndex |
private AtomicReference<com.yahoo.search.predicate.index.CachedPostingListCounter> |
postingListCounter |
private static int |
SERIALIZATION_FORMAT_VERSION |
private int[] |
zeroConstraintDocuments |
Constructor and Description |
---|
PredicateIndex(Config config,
int[] internalToExternalIdMapping,
byte[] minFeatureIndex,
short[] intervalEnds,
int highestIntervalEnd,
com.yahoo.search.predicate.index.SimpleIndex intervalIndex,
com.yahoo.search.predicate.index.SimpleIndex boundsIndex,
com.yahoo.search.predicate.index.SimpleIndex conjunctionIntervalIndex,
com.yahoo.search.predicate.index.PredicateIntervalStore intervalStore,
com.yahoo.search.predicate.index.conjunction.ConjunctionIndex conjunctionIndex,
int[] zeroConstraintDocuments)
Package private as the index should be constructed using
PredicateIndexBuilder . |
Modifier and Type | Method and Description |
---|---|
static PredicateIndex |
fromInputStream(DataInputStream in) |
void |
rebuildPostingListCache() |
PredicateIndex.Searcher |
searcher()
Create a new searcher.
|
void |
writeToOutputStream(DataOutputStream out) |
private static final int SERIALIZATION_FORMAT_VERSION
private final com.yahoo.search.predicate.index.PredicateRangeTermExpander expander
private final int[] internalToExternalIdMapping
private final byte[] minFeatureIndex
private final short[] intervalEnds
private final int highestIntervalEnd
private final com.yahoo.search.predicate.index.SimpleIndex intervalIndex
private final com.yahoo.search.predicate.index.SimpleIndex boundsIndex
private final com.yahoo.search.predicate.index.SimpleIndex conjunctionIntervalIndex
private final com.yahoo.search.predicate.index.PredicateIntervalStore intervalStore
private final com.yahoo.search.predicate.index.conjunction.ConjunctionIndex conjunctionIndex
private final int[] zeroConstraintDocuments
private final Config config
private final AtomicReference<com.yahoo.search.predicate.index.CachedPostingListCounter> postingListCounter
PredicateIndex(Config config, int[] internalToExternalIdMapping, byte[] minFeatureIndex, short[] intervalEnds, int highestIntervalEnd, com.yahoo.search.predicate.index.SimpleIndex intervalIndex, com.yahoo.search.predicate.index.SimpleIndex boundsIndex, com.yahoo.search.predicate.index.SimpleIndex conjunctionIntervalIndex, com.yahoo.search.predicate.index.PredicateIntervalStore intervalStore, com.yahoo.search.predicate.index.conjunction.ConjunctionIndex conjunctionIndex, int[] zeroConstraintDocuments)
PredicateIndexBuilder
.public void rebuildPostingListCache()
public PredicateIndex.Searcher searcher()
public void writeToOutputStream(DataOutputStream out) throws IOException
IOException
public static PredicateIndex fromInputStream(DataInputStream in) throws IOException
IOException
Copyright © 2018. All rights reserved.