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/AbstractGS2FieldSearch.java

    r29318 r29558  
    328328
    329329                addCustomQueryParams(param_list, lang);
    330                 createParameter(MAXDOCS_PARAM, param_list, lang);
    331330                if (!default_index_subcollection.equals(""))
    332331                {
     
    338337                }
    339338
     339                if (does_chunking) {
     340                  createParameter(MAXDOCS_PARAM, param_list, lang);
     341                }
    340342                if (does_paging)
    341343                {
     
    361363            {
    362364                addCustomQueryParamsAdvField(param_list, lang);
    363                 createParameter(MAXDOCS_PARAM, param_list, lang);
    364365                if (!default_index_subcollection.equals(""))
    365366                {
     
    394395                {
    395396                    createParameter(FIELD_ACCENT_PARAM, multiparam, lang);
     397                }
     398                if (does_chunking) {
     399                  createParameter(MAXDOCS_PARAM, param_list, lang);
    396400                }
    397401                if (does_paging)
     
    673677
    674678        // add a metadata item to specify docs returned
    675         int docs_returned = docs.length;
    676         if (does_paging)
    677         {
     679        if (does_chunking) // this means we have a max docs param, and might ask for only a subset of results
     680        {
     681          logger.error("does_chunking = true");
     682                int docs_returned = docs.length;
    678683            String maxdocs_str = (String) params.get(MAXDOCS_PARAM);
    679684            if (maxdocs_str != null)
    680685            {
    681686                int maxdocs = Integer.parseInt(maxdocs_str);
    682                 docs_returned = (maxdocs < (int) totalDocs ? maxdocs : (int) totalDocs);
    683             }
    684         }
    685         GSXML.addMetadata(metadata_list, "numDocsReturned", "" + docs_returned);
     687                if (maxdocs > 0) { // maxdocs==-1 means return all
     688                  docs_returned = (maxdocs < (int) totalDocs ? maxdocs : (int) totalDocs);
     689                }
     690            }
     691            GSXML.addMetadata(metadata_list, "numDocsReturned", "" + docs_returned);
     692        }
     693       
    686694
    687695        // add a metadata item to specify what actual query was done - eg if stuff was stripped out etc. and then we can use the query later, cos we don't know which parameter was the query
Note: See TracChangeset for help on using the changeset viewer.