Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/416#discussion_r210478700
--- 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 altered line 90 in response to my comment. I'm referring to line 92 --
`if(segPrevRootId == (rootDocId - 1))`, where my comment is.
Interesting though.... line 90 is different from the line of code I
committed to the feature branch. That line on the feature branch is:
`final int segPrevRootId = segParentsBitSet.prevSetBit(segRootId - 1); //
can return -1 and that's okay`
Notice there is no conditional, but there is in your version in this PR.
BitSet.prevSetBit will return -1 if given a 0 input (so says it's
documentation). That's what I was trying to say in my comment on the line of
code. Why did you change it?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]