lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Grand <jpou...@gmail.com>
Subject Re: Scorer.iterator() - how to implement correctly
Date Fri, 01 Dec 2017 08:11:06 GMT
There are many implementations because each query typically needs a custom
DocIdSetIterator implementation. It looks like your use-case doesn't need a
custom query though, you could use a TermQuery wrapped in a constant-score
query (see my reply to the other question you asked).

Le ven. 1 déc. 2017 à 08:24, Vadim Gindin <vgindin@detectum.com> a écrit :

> Hi
>
> I'm implementing the custom QUERY with appropriate custom WEIGHT and
> SCORER.
>
> I'm trying to implement Scorer.iterator() method. It should return an
> iterator of documents that matches the query. Right? There are a lot of
> descendant classes of the DocIdSetIterato.
>
> 1. How to choose correct one?
> 2. How to correctly implement Scorer.iterator() method?
>
> I've tried DocIdSetIterator.all(context.reader().maxDoc());
>
> But as I can see it returns all documents.
>
> My task looks simple. I need to return a constant score depending on the
> matched fields. I.e. field "model" score - 3f, field "vendor" - score - 5f.
>
> I'm creating a subquery for each field and specify score for it using
> custom QUERY that is almost the same as TermQuery except Weight.Scorer
>
> Any help is appreciated.
>
> Regards,
> Vadim Gindin
>

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