Closed IAntaresI closed 8 years ago
getNumFound
is a bit deprecated
If you use query()
you get an array of document which is countable, same with repository methods like findAll()
.
The documentation is written: $ Query = $ this-> get ( 'solr.client') -> createQuery ( 'AcmeDemoBundle: Post'); $ Query-> addSearchTerm ( 'title', 'my title'); $ Query-> addSearchTerm ( 'collection_field', array ( 'value1', 'value2'));
$ Result = $ query-> getResult ();
By default, array ($ result) 10 elements that needs to be done to find out the number of found suddenly all was found 11 records or 11 million? :) If more specific I need to do pagination on the search page. Or do I need to put a large number of known $ query-> setRows (1000000); and then calculate the result?
$query->setRows(1000000);
would be to expensive only for a calculation. I have restored the old behavior of getNumFound
.
Thank you very much.
in version 1.2 - $this->numberOfFoundDocuments = $response->getNumFound(); in FS/SolrBundle/Solr.php on line 259. In version 1.5, this is not method getNumFound () always returns 0. Or I do not understand how you can get the number of results found?