iamsanjay commented on code in PR #13319: URL: https://github.com/apache/lucene/pull/13319#discussion_r1587434132
########## lucene/queries/src/java/org/apache/lucene/queries/spans/SpanWeight.java: ########## @@ -135,16 +135,6 @@ private Similarity.SimScorer buildSimWeight( public abstract Spans getSpans(LeafReaderContext ctx, Postings requiredPostings) throws IOException; - @Override - public SpanScorer scorer(LeafReaderContext context) throws IOException { - final Spans spans = getSpans(context, Postings.POSITIONS); - if (spans == null) { - return null; - } - final LeafSimScorer docScorer = getSimScorer(context); - return new SpanScorer(this, spans, docScorer); - } - Review Comment: Well If we move the implementation of scorerSupplier to SpanWeight then all the subclasses can use the same scorerSupplier and then we can avoid making SpanScorerSupplier, If redundancy was your concern. Second, after moving the implementation there, we can return the SpanScorer from the `get()` method. However, we still may need to type cast because usually we pass reference to Weight, not to the concrete class. https://github.com/apache/lucene/blob/e40e1086f5aba195726aa0bc68afc8226e9268db/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/PhraseHelper.java#L263 Also I had to type cast in SpanWeight as well, because now SpanWeight calling `Weight#scorer()` which return Scorer. -- 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. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org 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