dsmiley commented on a change in pull request #2159: URL: https://github.com/apache/lucene-solr/pull/2159#discussion_r552241596
########## File path: solr/core/src/java/org/apache/solr/response/transform/ChildDocTransformer.java ########## @@ -76,6 +87,37 @@ public String getName() { @Override public boolean needsSolrIndexSearcher() { return true; } + @Override + public String[] getExtraRequestFields() { + return extraRequestedFields; + } + + private int getPrevRootGivenFilter(LeafReaderContext leafReaderContext, int segRootId) throws IOException { + final BitSet segParentsBitSet = parentsFilter.getBitSet(leafReaderContext); + if (segParentsBitSet != null) { + return segRootId == 0 ? -1 : segParentsBitSet.prevSetBit(segRootId - 1); + } + throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, + "Parent filter '" + parentsFilter + "' doesn't match any parent documents"); + } + + private int getPrevRootGivenId(LeafReaderContext leafReaderContext, int segRootId, + BytesRef idBytes) throws IOException { + final LeafReader reader = leafReaderContext.reader(); + final Terms terms = reader.terms(IndexSchema.ROOT_FIELD_NAME); // never returns null here + final TermsEnum iterator = terms.iterator(); + if (iterator.seekExact(idBytes)) { + PostingsEnum docs = iterator.postings(null, PostingsEnum.NONE); + docs = BitsFilteredPostingsEnum.wrap(docs, reader.getLiveDocs()); + int id = docs.nextDoc(); Review comment: Wrong; iterator.postings() never returns null -- so says its documentation. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org