Ignore:
Timestamp:
2019-10-03T18:56:15+13:00 (5 years ago)
Author:
ak19
Message:
  1. Dr Bainbridge had the correct fix for solr dealing with phrase searching where clicking on a facet then made search results disappear instead of showing the results within that facet. The problem was that double quotes ended up as html entities for ampersanded-quote and therefore didn't get URL encoded for transfer. Fixed now in java-script-global-setup.xsl, where all values gs.cgiParams[key] are taken care of. An additional fix was needed in facet-scripts.js, where makeURLComponentSafe() needed to be applied to each value of gs.cgiParams[] that got used when generating the searchString, notably the s1.query param value where the earlier omission of this step revealed an obvious problem. The facet portion of the URL was already taken care of in previous bugfixes. 3. Added some important comments and links.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/facet-scripts.js

    r33322 r33544  
    1515    for(var key in gs.cgiParams)
    1616    {
    17         if (gs.cgiParams.hasOwnProperty(key))
    18         {
    19             searchString += key.replace(/_/g, ".") + "=" + gs.cgiParams[key] + "&";
    20         }
     17        if (gs.cgiParams.hasOwnProperty(key))
     18        {
     19        searchString += key.replace(/_/g, ".") + "=" + makeURLComponentSafe(gs.cgiParams[key]) + "&";
     20        //console.log("PARAM FOR key " + key + ":" + gs.cgiParams[key]);
     21        //console.log("SAFE PARAM FOR " + key + ":" + makeURLComponentSafe(gs.cgiParams[key]));
     22        }
    2123    }
    2224   
     
    3234            // calling makeURLSafe() here will ensure percent signs are escaped away too
    3335            // by the end of makeURLComponentSafe() call below
     36            // Note that apostrophe's in URLs should get encoded, https://www.techwalla.com/articles/how-to-encode-an-apostrophe-in-a-url
     37            // though the apostrophe is not in that other list of invalid and unsafe chars in urls dealt with in utility_scripts.js         
    3438            countsStringBuffer += "\"" + makeURLSafe(counts[i]).replace(/'/g, "%2527") + "\"";
    3539            if(i < counts.length - 1)
Note: See TracChangeset for help on using the changeset viewer.