staticSearch
staticSearch copied to clipboard
In feature filters, minWordLength should never be longer than the shortest value
Feature filters currently inherit their minWordLength setting from the main StaticSearch class, where it is set primarily for the purposes of stem generation. However, it's possible for a feature filter to have an acceptable value that's shorter than this, and in that case, it's not possible to generate that value to create a checkbox for it. minWordLength for feature filters should be the min of the StaticSearch minWordLength and the min length of the feature filter value set items.
Rather than have the JS check the length of every single name in the JSON, I think it would make more sense to calculate this at build time and store it in the filter JSON as an additional property alongside filterId and filterName:
"minNameLength": 2
Then the SSTypeAhead constructor can compare it directly with the minWordLength that's passed to it by the StaticSearch object, and set its internal minWordLength property to the min of the two of them.
@joeytakeda Does that make sense? If so, it's a relatively easy fix in the json.xsl, I think.
@joeytakeda has implemented $minNameLength as a param in the feature filter JSON output; over to me to have the JS parse it and use it.