Changeset 27361


Ignore:
Timestamp:
05/16/13 15:38:21 (8 years ago)
Author:
kjdon
Message:

new handling of sortfield query param

Location:
main/trunk/greenstone2/runtime-src/src/colservr
Files:
2 edited

Legend:

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

    r27084 r27361  
    8080    ((lucenesearchclass *)textsearchptr)->set_text_level(cfgline[0]);
    8181  }
     82 
     83  else if (key == "indexsortfields") {
     84  filterOptions["SortField"].validValues.erase(filterOptions["SortField"].validValues.begin(), filterOptions["SortField"].validValues.end());
     85    text_tarray::const_iterator here = cfgline.begin();
     86    text_tarray::const_iterator end = cfgline.end();
     87    while (here != end) {
     88      if (!(*here).empty()) {
     89    filterOptions["SortField"].validValues.push_back(*here);
     90      }
     91      ++here;
     92    }
     93  }
    8294}
    8395
     
    88100  }
    89101 
    90   text_tarray field_array;
    91   indexfieldmap.gettoarray(field_array);
    92   for (int i=0; i<field_array.size(); i++) {
    93     text_t field = field_array[i];
    94     if (field!="ZZ" && field !="ZZ") {
    95       filterOptions["SortField"].validValues.push_back("by"+field);
    96     }
    97   }
    98   return true;
     102  if (filterOptions["SortField"].defaultValue.empty() && filterOptions["SortField"].validValues.begin() != filterOptions["SortField"].validValues.end() && !filterOptions["SortField"].validValues[0].empty()) {
     103      filterOptions["SortField"].defaultValue = filterOptions["SortField"].validValues[0];
     104  }
     105
     106   return true;
    99107}
    100108
  • main/trunk/greenstone2/runtime-src/src/colservr/lucenesearch.cpp

    r27332 r27361  
    123123    cmd += " -filter \"" + queryparams.filterstring + "\"";
    124124  }
    125   if (!queryparams.sortfield.empty()) {
     125  if (!queryparams.sortfield.empty() && queryparams.sortfield != "rank") {
    126126    cmd += " -sort \"" + queryparams.sortfield + "\"";
    127127  }
Note: See TracChangeset for help on using the changeset viewer.