public abstract class NodeScorer
extends org.apache.lucene.search.Scorer
Scorer
class that defines the interface for iterating
over an ordered list of nodes matching a query.
Subclasses should implement docID()
, nextDoc()
and
advance(int)
for compatibility with Scorer
if needed.
Modifier | Constructor and Description |
---|---|
protected |
NodeScorer(org.apache.lucene.search.Weight weight) |
Modifier and Type | Method and Description |
---|---|
int |
advance(int target) |
abstract int |
doc()
Returns the following:
-1 or
#NO_MORE_DOC if nextCandidateDocument() or
skipToCandidate(int) were not called yet. |
int |
docID() |
float |
freq() |
abstract float |
freqInNode()
Returns the number of occurrences in the current node
|
abstract boolean |
nextCandidateDocument()
Advances to the next candidate document in the set, or returns false if
there are no more docs in the set.
|
int |
nextDoc() |
abstract boolean |
nextNode()
Move to the next node path in the current document matching the query.
|
abstract org.apache.lucene.util.IntsRef |
node()
Returns the following:
-1 or
#NO_MORE_NOD if nextNode() were not called yet. |
float |
score()
Methods implemented in
LuceneProxyNodeScorer |
void |
score(org.apache.lucene.search.Collector collector) |
boolean |
score(org.apache.lucene.search.Collector collector,
int max,
int firstDocID) |
abstract float |
scoreInNode()
Returns the score of the current node of the current
document matching the query.
|
abstract boolean |
skipToCandidate(int target)
Skip to the first candidate document beyond (see NOTE below) the current
whose number is greater than or equal to target.
|
public abstract boolean nextCandidateDocument() throws IOException
A candidate document is a document that represents a potential match for
the query. All the sub-scorers agree on its document id. However finding
the matching node within this document still needs to be done. If the
sub-scorers do not agree on a node by calling nextNode()
, the
document must be considered as a non-matching document.
This method is useful for optimisation, i.e., lazy loading and comparison of node information. It allows to iterate over documents and find candidate without loading node information. Node information are loaded and compared only when a candidate is found.
IOException
public abstract boolean nextNode() throws IOException
Should not be called until nextCandidateDocument()
or
skipToCandidate(int)
are called for the first time.
nextCandidateDocument()
or skipToCandidate(int)
were not
called yet.IOException
public abstract boolean skipToCandidate(int target) throws IOException
NOTE: when target ≤ current
implementations must
not advance beyond their current doc()
.
IOException
public abstract int doc()
#NO_MORE_DOC
if nextCandidateDocument()
or
skipToCandidate(int)
were not called yet.
#NO_MORE_DOC
if the iterator has exhausted.
public abstract org.apache.lucene.util.IntsRef node()
#NO_MORE_NOD
if nextNode()
were not called yet.
#NO_MORE_NOD
if the iterator has exhausted.
public abstract float freqInNode() throws IOException
IOException
public abstract float scoreInNode() throws IOException
IOException
public float score() throws IOException
LuceneProxyNodeScorer
score
in class org.apache.lucene.search.Scorer
IOException
public void score(org.apache.lucene.search.Collector collector) throws IOException
score
in class org.apache.lucene.search.Scorer
IOException
public boolean score(org.apache.lucene.search.Collector collector, int max, int firstDocID) throws IOException
score
in class org.apache.lucene.search.Scorer
IOException
public float freq() throws IOException
freq
in class org.apache.lucene.search.Scorer
IOException
public int docID()
docID
in class org.apache.lucene.search.DocIdSetIterator
public int nextDoc() throws IOException
nextDoc
in class org.apache.lucene.search.DocIdSetIterator
IOException
public int advance(int target) throws IOException
advance
in class org.apache.lucene.search.DocIdSetIterator
IOException
Copyright © 2014. All rights reserved.