dsmiley commented on a change in pull request #1142: SOLR-14166: fq cache=false should use TwoPhaseIterator URL: https://github.com/apache/lucene-solr/pull/1142#discussion_r363293567
########## File path: solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/SolrFeature.java ########## @@ -237,21 +237,25 @@ public FeatureScorer scorer(LeafReaderContext context) throws IOException { * @return DocIdSetIterator to traverse documents that matched all filter * criteria */ + // TODO it's not optimal to call getProcessedFilter per-segment! Save the results into one Query + // TODO rename to "FromFilterQueries" suffix to at least suggest this uses the filter cache private DocIdSetIterator getDocIdSetIteratorFromQueries(List<Query> queries, LeafReaderContext context) throws IOException { final SolrIndexSearcher.ProcessedFilter pf = ((SolrIndexSearcher) searcher) .getProcessedFilter(null, queries); - final Bits liveDocs = context.reader().getLiveDocs(); - - DocIdSetIterator idIter = null; - if (pf.filter != null) { - final DocIdSet idSet = pf.filter.getDocIdSet(context, liveDocs); - if (idSet != null) { - idIter = idSet.iterator(); - } + if (pf.postFilter != null) { + throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, + "PostFilter queries are not supported"); } - - return idIter; + Query q = pf.filter; + if (q == null) { + q = new MatchAllDocsQuery(); // usually never happens? + } + Scorer scorer = q.createWeight(searcher, ScoreMode.COMPLETE_NO_SCORES, 1f).scorer(context); + if (scorer != null) { + return scorer.iterator(); Review comment: This particular method on this class for LTR wants to return a DocIdSetIterator. You are correct that this method will not completely benefit from TwoPhaseIterator as-designed. It will benefit from the cost ordering aspect though. I like your suggestion of returning a Scorer, thus enabling the caller to _potentially_ use it better (it does not today). But I don't want to scope creep this PR into the LTR module more than necessary to accomplish the primary goal of the PR. If what you propose is pretty simple then it can be done now but I don't see it. ---------------------------------------------------------------- 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 With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org