Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I do count (*) in the Lucene query string?

I am working with a system where I can provide a Lucene query string, but have no access to the Lucene API itself. I only provide a query string and get a list of domain specific result objects.

From my reading so far, it seems that I cannot do the equivalent of a select count(*) where ... with just the query string, but I am not 100% sure that I understood. Is this correct?

like image 213
Robert Mark Bram Avatar asked Nov 30 '15 02:11

Robert Mark Bram


1 Answers

The QueryParser syntax does not include any functions of that sort, no.

The Lucene API provides the count of total matches with it's result set. Solr and ElasticSearch also return the count. If the interface you are using doesn't expose that figure, there isn't any feature of the Lucene QueryParser syntax that will help you gain access to it.

like image 74
femtoRgon Avatar answered Oct 03 '22 05:10

femtoRgon