LUCENE-5693, LUCENE-5675: also decouple this bug fix (move to LUCENE-5693) in ToParentBJQ.explain

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5675@1596783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-05-22 09:08:54 +00:00
parent c5ac331b85
commit fffcb1b3f4
2 changed files with 13 additions and 17 deletions

View File

@ -24,9 +24,11 @@ BlockTree terms dictionary.
<p>
This terms dictionary organizes all terms into blocks according to
shared prefix, and then stores the prefix trie in memory as an FST as
the index structure. It allows you to plug in your own {@link
org.apache.lucene.codecs.PostingsBaseFormat} to implement the postings.
shared prefix, such that each block has enough terms, and then stores
the prefix trie in memory as an FST as the index structure. It allows
you to plug in your own {@link
org.apache.lucene.codecs.PostingsBaseFormat} to implement the
postings.
</p>
<p>See {@link org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter}

View File

@ -381,7 +381,7 @@ public class ToParentBlockJoinQuery extends Query {
@Override
public int advance(int parentTarget) throws IOException {
// System.out.println("Q.advance parentTarget=" + parentTarget);
//System.out.println("Q.advance parentTarget=" + parentTarget);
if (parentTarget == NO_MORE_DOCS) {
return parentDoc = NO_MORE_DOCS;
}
@ -398,13 +398,13 @@ public class ToParentBlockJoinQuery extends Query {
prevParentDoc = parentBits.prevSetBit(parentTarget-1);
// System.out.println(" rolled back to prevParentDoc=" + prevParentDoc + " vs parentDoc=" + parentDoc);
//System.out.println(" rolled back to prevParentDoc=" + prevParentDoc + " vs parentDoc=" + parentDoc);
assert prevParentDoc >= parentDoc;
if (prevParentDoc > nextChildDoc) {
nextChildDoc = childScorer.advance(prevParentDoc);
// System.out.println(" childScorer advanced to child docID=" + nextChildDoc);
} else {
// System.out.println(" skip childScorer advance");
//} else {
//System.out.println(" skip childScorer advance");
}
// Parent & child docs are supposed to be orthogonal:
@ -413,21 +413,15 @@ public class ToParentBlockJoinQuery extends Query {
}
final int nd = nextDoc();
// System.out.println(" return nextParentDoc=" + nd);
//System.out.println(" return nextParentDoc=" + nd);
return nd;
}
public Explanation explain(int docBase) throws IOException {
int start = prevParentDoc + 1; // +1 b/c prevParentDoc is previous parent doc
if (acceptDocs != null) {
// Skip deleted docs:
while (acceptDocs.get(start) == false) {
start++;
}
}
int end = parentDoc - 1; // -1 b/c parentDoc is parent doc
int start = docBase + prevParentDoc + 1; // +1 b/c prevParentDoc is previous parent doc
int end = docBase + parentDoc - 1; // -1 b/c parentDoc is parent doc
return new ComplexExplanation(
true, score(), String.format(Locale.ROOT, "Score based on child doc range from %d to %d", docBase+start, docBase+end)
true, score(), String.format(Locale.ROOT, "Score based on child doc range from %d to %d", start, end)
);
}