Needs work
Project:
Facet API
Version:
7.x-1.x-dev
Component:
Current Search Blocks
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
25 Nov 2012 at 18:25 UTC
Updated:
8 Sep 2017 at 10:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) 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) 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) commentedPossible patch attached....
Comment #4
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 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.