Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/416#discussion_r210600024
  
    --- 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 --
    
    Ooooh, good catch.
    
    Lets enhance the tests in this file a bit to help us give confidence that 
we're using docIDs correctly (and help avoid future enhancers/modifiers from 
introducing similar bugs).  Here's what I propose:  in the @BeforeClass, if 
random().nextBoolean(), add some nested docs -- using one of your existing 
nested document adding methods.  And randomly do a commit() to flush the 
segment.  Later in the test methods we need to add a filter query that will 
exclude those docs.  One way to do this is to ensure these first docs have some 
field we can exclude.  Another way might be knowing the maximum uniqueKey ID 
you can query by prior to the test starting, and then adding a filter query 
with a range saying the uniqueKey must be at least this value.  Make sense?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to