Hi,
I would like to get the number of hits per document.
I googled around a lot, there were code snipplets for older versions. None
of them works with Lucene 6.1.
Any help would be appreciated.
--
View this message in context:
http://lucene.472066.n3.nabble.com/Lucene-6-1-number-of-hits-per-d
What do you mean by "number of hits per documents"? Can you give an example
maybe?
Le jeu. 25 août 2016 à 16:29, szzoli a écrit :
> Hi,
>
> I would like to get the number of hits per document.
> I googled around a lot, there were code snipplets for older versions. None
> of them works with Lucen
I was searching for a word in an index (multiple files were indexed in a
library). I was searching e.g for "run". A document contained two times, an
other three times this word.
I would like to see int the result for the firs document "2", for the other
"3".
Thank you
Adrien Grand wrote
> What
Le lun. 29 août 2016 à 12:00, a écrit :
> I was searching for a word in an index (multiple files were indexed in a
> library). I was searching e.g for "run". A document contained two times, an
> other three times this word.
> I would like to see int the result for the firs document "2", for the
>
try fl=*,tf(text,'run')
or check explanation on debugQuery=true
it's present in lines with termFreq or tf()
On Mon, Aug 29, 2016 at 1:02 PM, szzoli wrote:
> I was searching for a word in an index (multiple files were indexed in a
> library). I was searching e.g for "run". A document contained tw
I used:
Analyzer analyzer = new StandardAnalyzer();
QueryParser parser = new QueryParser(field, analyzer);
Query query = parser.parse(queryString);
TermQuery cannot be created this way.
Scorer.freq(), Collector.setScorer() how can be obtained?
Original Message-
> From: Mikhail Khludnev [mailto:m...@apache.org]
> Sent: Monday, August 29, 2016 2:17 PM
> To: java-user@lucene.apache.org
> Subject: Re: Lucene 6.1: number of hits per document
>
> try fl=*,tf(text,'run')
> or check explanation on debugQuery=true
&
Adrien:
"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
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
I created a collector with
SimpleCollector collector = new TotalHitCountCollector();
but when I wanted to call
collector.setScorer(scorer);
the scorer has again several parameters:
Scorer scorer = new ConstantScoreScorer(Weight, float, disi);
Do I have to create these objects, too?
--
View this
IndexSearcher will call LeafCollector.setScorer(Scorer) for you when you
call IndexSearcher.search(Query, Collector). All you need to do is to keep
a reference to this Scorer object and use it in the
LeafCollector.collect(int) method.
Le jeu. 1 sept. 2016 à 14:42, szzoli a écrit :
> I created a
I call
IndexSearcher.search(Query, Collector)
but it is void. Where can I obtain the Scorer object?
collector.getTotalHits()
seems to return the number of the documents.
How can I tell it that it should count the hits in the approriate document?
--
View this message in context:
http://lucene.
What is an "appropriate document"? This discussion looks like an XY problem
where you are asking about freqs while the actual problem you are trying to
solve is different. Anyway, here are two ways to get freqs, first only for
the top docs and then inside a collector: http://pastebin.com/FfFy2Amp.
This link helped me, it contained the solution.
Thank you!
--
View this message in context:
http://lucene.472066.n3.nabble.com/Lucene-6-1-number-of-hits-per-document-tp4293245p4294403.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
--
14 matches
Mail list logo