Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Once I got over 1 million results, the current search block says 'Found 1 result'. See screenshots for my configuration. This happens only when I have more than 1 million results.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1850098-3.patch | 774 bytes | Anonymous (not verified) |
1mio-results.png | 12.44 KB | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedAlso, it fails to translate. I have this setup with i18n and it should have translated 'Found 1 result' into Dutch. So no only does it fail to plural, but it also fails to translate with > 1mio results.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedI found the problem. In CurrentSearchItemText->execute() of item_text.inc, there is a line that reads:
We are looking for [facetapi_results:result-count], but this has thousand separators! Solr returns the value with dots (.) as thousand separators:
(int) 1.000 = 1
(int) 1.123.123 = 1
See how it always becomes 1 if you go over 999.
A solution like this works:
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedPossible patch attached....
Comment #4
cpliakas CreditAttribution: cpliakas commentedIs this configured by a param set via Apache Solr Search Integration or Search API, or is it hard coded somewhere? It would be great to get that value as opposed to assuming a dot. Other than that I think the logic seems fine to me.
Bumping back to the 7.x-1.x branch so it doesn't continue to elude my radar.
Thanks,
Chris
Comment #5
cpliakas CreditAttribution: cpliakas commentedLooking into this further, the value is converted to an int in the facetapi.tokens.inc file so it is already "1" but the time it gets to the execute() method therefore the patch doesn't fix the issue.
Looking into the facetapi.tokens.inc code, we are likely going to have to remove the cast to an int, handle the digit grouping separators used throughout the world (as highlighted at http://www.statisticalconsultants.co.nz/weeklyfeatures/WF31.html), and audit that the escaping of the values doesn't assume the values have already been cast to an integer.
Marking as needs work since this is a little more complex to resolve.