Changeset 28125 for gs3-extensions

Show
Ignore:
Timestamp:
26.08.2013 11:47:57 (6 years ago)
Author:
davidb
Message:

Added if-statement test to make sure sort_field exists before it is used. Using the search box on the 'about' page is one place where this can occur, for example.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/util/SolrQueryWrapper.java

    r28063 r28125  
    5454    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.SolrQueryWrapper.class.getName()); 
    5555    protected int max_docs = 100; 
    56   protected String sort_order = SORT_DESCENDING; 
     56    protected String sort_order = SORT_DESCENDING; 
    5757    protected ArrayList<String> _facets = new ArrayList<String>(); 
    5858    protected ArrayList<String> _facetQueries = new ArrayList<String>(); 
     
    201201        solrParams.set("q", query_string); 
    202202        // sort param, like "score desc" or "byORG asc" 
    203         solrParams.set("sort", this.sort_field+" "+this.sort_order); 
     203 
     204        if (this.sort_field != null) { 
     205            solrParams.set("sort", this.sort_field+" "+this.sort_order); 
     206        } 
     207 
    204208        // which result to start from 
    205209        solrParams.set("start", start_results);