Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/416#discussion_r210322181
--- Diff:
solr/core/src/java/org/apache/solr/response/transform/ChildDocTransformer.java
---
@@ -87,7 +87,12 @@ public void transform(SolrDocument rootDoc, int
rootDocId) {
final int segBaseId = leafReaderContext.docBase;
final int segRootId = rootDocId - segBaseId;
final BitSet segParentsBitSet =
parentsFilter.getBitSet(leafReaderContext);
- final int segPrevRootId = segParentsBitSet.prevSetBit(segRootId -
1); // can return -1 and that's okay
+ final int segPrevRootId = rootDocId==0? -1:
segParentsBitSet.prevSetBit(segRootId - 1); // can return -1 and that's okay
+
+ if(segPrevRootId == (rootDocId - 1)) {
--- End diff --
you are comparing a segment local ID with a global ID which is incorrect.
You should refer to segRootId. This is why I'm particular about using "seg"
nomenclature in a body of code that deals with both segment and global IDs --
it makes it at least easier to identify such an error. It's difficult to get
tests to detect this; we'd need to commit some docs up front to cause more
segments to be created than many tests will do.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]