lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yoav Goldberg <yoav.goldb...@gmail.com>
Subject where can I register a new scorer in an existing query?
Date Sat, 19 Oct 2019 16:59:19 GMT
Hello,

Is there a way to supply a new Scorer implementation to an existing query?
>From what I've been able to understand, the only way to provide a new
scorer is to change the scorer() method Weight, which in itself requires
implementing a new Weight, which in itself requires implementing a whole
new Query. Is there something I am missing here?

To be more concrete about what I want to achieve (maybe there is a
different / better way):
I would like to collect the *match positions* of several sub-queries, for
all matching documents. The ideal interface would be to perform search as
usual, and supply a collector that has access and collects this
information. Alternatively, to have it available in the returned results
object.

The needed information is available during search (in the internal
iterators), but I did not find a way to access it. The Weight.matches() and
SpanWeight.getSpans() methods return the iterators I'd need, but they also
require a LeafReaderContext, which I believe is only available during
search? So I thought I'd create a scorer (that gets a context and gets
called for the relevant document), but I do not see a way to supply a
custom scorer.

Any tips are greatly appreciated.

Thanks!

Yoav

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message