Ignore:
Timestamp:
2013-03-12T14:37:44+13:00 (11 years ago)
Author:
kjdon
Message:

adding reverse sort/sort order in for lucene search results sorting. reorganising code to avoid duplication, added fieldedqueryfilter in the chain of inheritance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/colservr/mgqueryfilter.cpp

    r16445 r27064  
    285285
    286286  num_phrases = 0;
     287
     288  FilterOption_t filtopt;
     289  // -- onePerQuery  PhraseMatch  enumerated
     290  filtopt.name = "PhraseMatch";
     291  filtopt.type = FilterOption_t::enumeratedt;
     292  filtopt.repeatable = FilterOption_t::onePerQuery;
     293  filtopt.defaultValue = "some_phrases";
     294  filtopt.validValues.push_back ("all_phrases");
     295  filtopt.validValues.push_back ("some_phrases");
     296  filtopt.validValues.push_back ("all_docs");
     297  filterOptions["PhraseMatch"] = filtopt;
     298
    287299}
    288300
     
    331343              endresults, phrasematch, logout);
    332344  // do any mg specific diddling with query parameters that may be required
    333   mg_parse_query_params (request, queryfilterparams, startresults,
    334              endresults, phrasematch, logout);
     345  //  mg_parse_query_params (request, queryfilterparams, startresults,
     346  //             endresults, phrasematch, logout);
    335347
    336348
     
    448460}
    449461
    450 void mgqueryfilterclass::mg_parse_query_params (const FilterRequest_t &/*request*/,
     462void mgqueryfilterclass::parse_query_params (const FilterRequest_t &request,
    451463                        vector<queryparamclass> &query_params,
    452                         int &/*startresults*/, int &/*endresults*/,
    453                         text_t &/*phrasematch*/, ostream &/*logout*/) {
    454 
    455   //  outconvertclass text_t2ascii;
     464                        int &startresults, int &endresults,
     465                        text_t &phrasematch, ostream &logout) {
     466
     467  queryfilterclass::parse_query_params (request, query_params,
     468                    startresults, endresults, logout);
     469
     470  phrasematch = filterOptions["PhraseMatch"].defaultValue;
     471
     472  // is there a better way to do this than iterate through all the options again??
     473  OptionValue_tarray::const_iterator options_here = request.filterOptions.begin();
     474  OptionValue_tarray::const_iterator options_end = request.filterOptions.end();
     475  while (options_here != options_end) {
     476    if ((*options_here).name == "PhraseMatch") {
     477      phrasematch = (*options_here).value;
     478      break;
     479    }
     480    ++options_here;
     481  }
    456482 
    457483  vector<queryparamclass>::iterator query_here = query_params.begin();
Note: See TracChangeset for help on using the changeset viewer.