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

Reply via email to