lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Grand <>
Subject Re: Lucene 6.1: number of hits per document
Date Thu, 01 Sep 2016 12:29:45 GMT
Maybe you should clarify your use-case. For instance Uwe was assuming that
you needed this information for debugging purposes while I was assuming
that you needed it for your application logic.

Le jeu. 1 sept. 2016 à 14:20, szzoli <> a écrit :

> "If the Query is a TermQuery, you can get this number by calling
> Scorer.freq() on the Scorer that is passed to Collector.setScorer()."
> My problem is that I do not know how can one get Scorer.freq(). Scorer is
> an
> abstect class. It has many deived classes. I don't know wich one to use.
> The
> derived classes are sometimes also abstract. The non-abstract classes have
> constuctors with some other class parameters (Weight float score,
> DocIdSetIterator for ConstantScoreScorer, e.g.) Some of them are also
> abstract. Now again I have to look for some subclasses.
> They also might be abstract, or have constuctors with several class
> parameters, ans so on...

I was not suggesting that you create the Scorer object yourself. Instead, I
was thinking that maybe you had a custom collector, in which case you could
get call Scorer.freq() to get the number of matches in the current
document. But given your reply it seems like you do not even have a custom
collector, I think it would really help if you could clarify your use-case.

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