You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Briggs Thompson <w....@gmail.com> on 2011/07/05 18:13:32 UTC
Hit Rate
Hello all,
Is there a good way to get the hit count of a search?
Example query:
textField:solr AND documentId:1000
Say document with Id = 1000 has "solr" 13 times in the document. Any way to
extract that number [13] in the response? I know we can return the score
which is loosely related to hit counts via tf-idf, but for this case I need
the actually hit counts. I believe you can get this information from the
logs, but that is less useful if the use case is on the presentation layer.
I tried faceting on the query but it seems like that returns the number of
documents that query matches rather than the hit count.
http://localhost:8080/solr/ExampleCore/select/?q=textField%3Asolr+AND+documentId%3A1246727&version=2.2&start=0&rows=10&indent=on&&facet=true&face.field=textField:solr&facet.query=<http://cobra:8080/solr/BusinessDescriptionCore/select/?q=businessDescription%3Afacebook+AND+businessDescriptionId%3A1246727&version=2.2&start=0&rows=10&indent=on&&facet=true&face.field=businessDescriptionQuoted:facebook&facet.query=businessDescriptionQuoted:facebook>
textField:solr<http://cobra:8080/solr/BusinessDescriptionCore/select/?q=businessDescription%3Afacebook+AND+businessDescriptionId%3A1246727&version=2.2&start=0&rows=10&indent=on&&facet=true&face.field=businessDescriptionQuoted:facebook&facet.query=businessDescriptionQuoted:facebook>
I was thinking that highlighting essentially returns the hit count if you
supply unlimited amount of snippets, but I imagine there must be a more
elegant solution.
Thanks in advance,
Briggs
Re: Hit Rate
Posted by Briggs Thompson <w....@gmail.com>.
Yes indeed, that is what I was missing. Thanks Ahmet!
On Tue, Jul 5, 2011 at 12:48 PM, Ahmet Arslan <io...@yahoo.com> wrote:
>
> > Is there a good way to get the hit count of a search?
> >
> > Example query:
> > textField:solr AND documentId:1000
> >
> > Say document with Id = 1000 has "solr" 13 times in the
> > document. Any way to
> > extract that number [13] in the response?
>
> Looks like you are looking for term frequency info:
>
> Two separate solutions:
> http://wiki.apache.org/solr/TermVectorComponent
> http://wiki.apache.org/solr/FunctionQuery#tf
>
>
>
Re: Hit Rate
Posted by Ahmet Arslan <io...@yahoo.com>.
> Is there a good way to get the hit count of a search?
>
> Example query:
> textField:solr AND documentId:1000
>
> Say document with Id = 1000 has "solr" 13 times in the
> document. Any way to
> extract that number [13] in the response?
Looks like you are looking for term frequency info:
Two separate solutions:
http://wiki.apache.org/solr/TermVectorComponent
http://wiki.apache.org/solr/FunctionQuery#tf