Changeset 13574


Ignore:
Timestamp:
2007-01-11T14:47:42+13:00 (17 years ago)
Author:
kjdon
Message:

if there is only one level, add level param as an invisible parameter just in case there is level info hanging around in the cached params which may not be valid. also, doc_returned, don't rely on docs.length - if we are doing paging in the indexer, then we are only returning a subset of the results available

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractGS2FieldSearch.java

    r13270 r13574  
    294294        // the first one is the default
    295295        param = GSXML.createParameterDescription2(this.doc, LEVEL_PARAM, getTextString("param."+LEVEL_PARAM, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, (String)level_ids.get(0), level_ids, level_names);
    296         }
    297        
     296        } else {
     297        // we need to set the level, but hidden, in case there is an invalid level saved
     298        param = GSXML.createParameterDescription(this.doc, LEVEL_PARAM, "", GSXML.PARAM_TYPE_INVISIBLE, (String)level_ids.get(0), null, null);
     299        }
    298300    } else if (name.equals(RANK_PARAM)) {
    299301        String [] vals1 = {RANK_PARAM_RANK, RANK_PARAM_NONE };
     
    481483
    482484    // add a metadata item to specify docs returned
    483     GSXML.addMetadata(this.doc, metadata_list, "numDocsReturned", ""+docs.length);
     485    int docs_returned = docs.length;
     486    if (does_paging) {
     487        int maxdocs = Integer.parseInt((String)params.get(MAXDOCS_PARAM));
     488        docs_returned = (maxdocs < (int)totalDocs ? maxdocs : (int)totalDocs);
     489    }
     490    GSXML.addMetadata(this.doc, metadata_list, "numDocsReturned", ""+docs_returned);
    484491    // 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
    485492    GSXML.addMetadata(this.doc, metadata_list, "query", query);
Note: See TracChangeset for help on using the changeset viewer.