mirror of https://github.com/apache/lucene.git
SOLR-1284: implement new DISI.advance
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@794714 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b5620d8614
commit
3c02e971ea
|
@ -107,6 +107,34 @@ public class FunctionQuery extends Query {
|
|||
vals = func.getValues(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int docID() {
|
||||
return doc;
|
||||
}
|
||||
|
||||
@Override
|
||||
// instead of matching all docs, we could also embed a query.
|
||||
// the score could either ignore the subscore, or boost it.
|
||||
// Containment: floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
|
||||
// Boost: foo:myTerm^floatline("myFloatField",1.0,0.0f)
|
||||
public int nextDoc() throws IOException {
|
||||
for(;;) {
|
||||
++doc;
|
||||
if (doc>=maxDoc) {
|
||||
return doc=NO_MORE_DOCS;
|
||||
}
|
||||
if (hasDeletions && reader.isDeleted(doc)) continue;
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int advance(int target) throws IOException {
|
||||
// this will work even if target==NO_MORE_DOCS
|
||||
doc=target-1;
|
||||
return nextDoc();
|
||||
}
|
||||
|
||||
// instead of matching all docs, we could also embed a query.
|
||||
// the score could either ignore the subscore, or boost it.
|
||||
// Containment: floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
|
||||
|
|
|
@ -78,6 +78,27 @@ class ValueSourceScorer extends Scorer {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int docID() {
|
||||
return doc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int nextDoc() throws IOException {
|
||||
for(;;) {
|
||||
doc++;
|
||||
if (doc >= maxDoc) return doc=NO_MORE_DOCS;
|
||||
if (matches(doc)) return doc;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int advance(int target) throws IOException {
|
||||
// also works fine when target==NO_MORE_DOCS
|
||||
doc = target-1;
|
||||
return nextDoc();
|
||||
}
|
||||
|
||||
public int doc() {
|
||||
return doc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue