Ignore:
Timestamp:
2014-12-08T14:46:32+13:00 (9 years ago)
Author:
kjdon
Message:

work around does_paging, does_chunking. only add in maxdocs, hitsperpage params if the service actually uses them. lucnee/solr, don't use maxdocs any more. I haven't had a chance to clean up the changes, but I need to commit, so there may be extraneous debug statements still here.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2LuceneSearch.java

    r29544 r29558  
    4141public class GS2LuceneSearch extends SharedSoleneGS2FieldSearch
    4242{
     43
    4344  protected static final String SORT_ORDER_PARAM = "reverseSort";
    4445  protected static final String SORT_ORDER_REVERSE = "1";
     
    5152    public GS2LuceneSearch()
    5253    {
     54      does_paging = true;
    5355        paramDefaults.put(SORT_ORDER_PARAM, SORT_ORDER_NORMAL);
    5456        this.lucene_src = new GS2LuceneQuery();
     
    98100   
    99101  }
     102   
    100103    /** methods to handle actually doing the query */
    101104
     
    108111        String physical_index_language_name = null;
    109112        String physical_sub_index_name = null;
    110         int maxdocs = Integer.parseInt(paramDefaults.get(MAXDOCS_PARAM));
    111113        int hits_per_page = Integer.parseInt(paramDefaults.get(HITS_PER_PAGE_PARAM));
    112114        int start_page = Integer.parseInt(paramDefaults.get(START_PAGE_PARAM));
    113115        String sort_field = getLuceneSort(default_sort);
    114116        String sort_order = paramDefaults.get(SORT_ORDER_PARAM);
     117           
    115118        // set up the query params
    116119        Set entries = params.entrySet();
     
    122125            String value = (String) m.getValue();
    123126
    124             if (name.equals(MAXDOCS_PARAM) && !value.equals(""))
    125             {
    126                 maxdocs = Integer.parseInt(value);
    127             }
    128             else if (name.equals(HITS_PER_PAGE_PARAM))
    129             {
    130                 hits_per_page = Integer.parseInt(value);
     127            if (name.equals(HITS_PER_PAGE_PARAM))
     128            {
     129              if (value.equals("all")) {
     130                hits_per_page = -1;
     131              } else {
     132                hits_per_page = Integer.parseInt(value);
     133              }
    131134            }
    132135            else if (name.equals(START_PAGE_PARAM))
     
    177180        // set up start and end results if necessary
    178181        int start_results = 1;
    179         if (start_page != 1)
     182        if (start_page > 1 && hits_per_page > 0)
    180183        {
    181184            start_results = ((start_page - 1) * hits_per_page) + 1;
    182185        }
    183         int end_results = hits_per_page * start_page;
     186        int end_results = Integer.MAX_VALUE;
     187        if (hits_per_page > 0) {
     188          end_results = hits_per_page * start_page;
     189        }
    184190        this.lucene_src.setStartResults(start_results);
    185191        this.lucene_src.setEndResults(end_results);
Note: See TracChangeset for help on using the changeset viewer.