Ignore:
Timestamp:
2018-01-24T20:46:30+13:00 (6 years ago)
Author:
ak19
Message:

Forgot to commit bugfix. The bug was that when searching a solr collection, if you switch on a facet containing an apostrophe (try searching solr-demo for query term farm and then selecting the facet with apostrophe), there are 0 search results displayed for that facet despite the facet listing a positive number of matching docs for it. 1. Greenstone3SearchHandler.java and facet-scripts.js contain the fix. 2. GS2SolrSearch.java and SolrQueryWrapper.java just contain further debug statements, some commented out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/solrserver/Greenstone3SearchHandler.java

    r29991 r32110  
    7777public class Greenstone3SearchHandler extends SearchHandler
    7878{
    79     // IMPORTANT NOTE: Logging doesn't work in this class either with log4j or slf4j,
     79    // IMPORTANT NOTES: 1. Logging doesn't work in this class either with log4j or slf4j,
    8080    // but System.err goes to catalina.out.
     81    // 2. To compile this class, "ant compile" in ext/solr is insufficient. The class file produced
     82    // isn't copied into tomcat. Need to do "ant compile-gs3-solrserver".
    8183
    8284    //protected static Logger log = LoggerFactory.getLogger(Greenstone3SearchHandler.class);
     
    157159
    158160    if(query_string == null || query_string.equals("")) {
    159         log.error("@@@@@@@@@ " + this.getClass() + " - QUERY STRING EMPTY");
     161        //log.error("@@@@@@@@@ " + this.getClass() + " - QUERY STRING EMPTY"); // logging won't work
     162        System.err.println("@@@@@@@@@ " + this.getClass() + " - QUERY STRING EMPTY");
    160163    }
    161164    else {
     
    234237
    235238        // totaltermfreq(TI, 'farming')
    236         // termfreq(TI, 'farming')     
     239        // termfreq(TI, 'farming')
     240        //System.err.println("@@@@ SOLR FACET queryTerm: " + queryTerm);
    237241        solrParams.addField("totaltermfreq(" + field + ",'" + queryTerm + "')");
    238242        solrParams.addField("termfreq(" + field + ",'" + queryTerm + "')");
     243
     244        // handle the special case of apostrophes in facet query terms
     245        // (facet_scripts.js does the other half of handling them)
     246        query_string = query_string.replace("%27", "'");
     247        solrParams.set("q", query_string);
     248       
     249        System.err.println("@@@@ SOLR FACET query_string: " + query_string);
    239250        }
    240251    }
Note: See TracChangeset for help on using the changeset viewer.