cpoerschke commented on a change in pull request #1381: SOLR-14364: LTR SolrFeature fq improvements URL: https://github.com/apache/lucene-solr/pull/1381#discussion_r402945403
########## File path: solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/SolrFeature.java ########## @@ -280,52 +243,10 @@ public float score() throws IOException { @Override public float getMaxScore(int upTo) throws IOException { - return Float.POSITIVE_INFINITY; - } - } - - /** - * An iterator that allows to iterate only on the documents for which a feature has - * a value. - **/ - public class SolrFeatureScorerIterator extends DocIdSetIterator { - - final private DocIdSetIterator filterIterator; - final private DocIdSetIterator scorerFilter; - - SolrFeatureScorerIterator(DocIdSetIterator filterIterator, - DocIdSetIterator scorerFilter) { - this.filterIterator = filterIterator; - this.scorerFilter = scorerFilter; - } - - @Override - public int docID() { - return filterIterator.docID(); - } - - @Override - public int nextDoc() throws IOException { - int docID = filterIterator.nextDoc(); - scorerFilter.advance(docID); - return docID; - } - - @Override - public int advance(int target) throws IOException { - // We use iterator to catch the scorer up since - // that checks if the target id is in the query + all the filters - int docID = filterIterator.advance(target); - scorerFilter.advance(docID); - return docID; - } - - @Override - public long cost() { - return filterIterator.cost() + scorerFilter.cost(); + return solrScorer.getMaxScore(upTo); } + // TODO delegate more methods? Review comment: In case it helps, I've branched off your branch here, merged latest master into it and added small [commit](https://github.com/cpoerschke/lucene-solr/commit/56af94b59e0377c4a1279ed5569ba4cc8cea0ee2) for `SolrFeature` here extending `FilterFeatureScorer`. ---------------------------------------------------------------- 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