jpountz 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_r363189378
########## 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: Assuming the query produces two-phase iterators, this will create an iterator that wraps the two-phase iterator and mostly defeats the point of using two-phase iterators. Should we return the scorer directly and let the caller do the right thing, ie. use the two-phase iterator if the query produces one, or the iterator otherwise (possibly reusing` ConjunctionDISI#intersectScorers`)? ---------------------------------------------------------------- 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