Changeset 10954 for trunk/gsdl


Ignore:
Timestamp:
2005-11-28T16:53:56+13:00 (18 years ago)
Author:
kjdon
Message:

made the indexfieldmap use defaultindex for mgppqueryfilter so that can set the default field for plain search

Location:
trunk/gsdl/src/colservr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/mgppqueryfilter.cpp

    r9937 r10954  
    7878    text_tarray options;
    7979    indexfieldmap.gettoarray (options);
    80     filterOptions["IndexField"].validValues.erase(filterOptions["IndexField"].validValues.begin(), filterOptions["IndexField"].validValues.end());
    81     text_tarray::const_iterator here = options.begin();
    82     text_tarray::const_iterator end = options.end();
    83     bool start = true;
    84     while (here !=end) {
    85       if (!(*here).empty()) {
    86     filterOptions["IndexField"].validValues.push_back(*here);
    87     if (start) {
    88       filterOptions["IndexField"].defaultValue = *here;
    89       start = false;
    90     }
    91       }
    92       ++here;
    93     }
     80    filterOptions["IndexField"].validValues = options;
    9481   
    9582  } else if (key == "indexlevels") {
     
    113100  } else if (key == "indexstem") {
    114101    ((mgppsearchclass *)textsearchptr)->set_indexstem (cfgline[0]);
    115   }
    116  
    117 }
    118 
     102  } else if (key == "defaultindex") { // used for fields in mgpp
     103    indexfieldmap.from2to (cfgline[0], filterOptions["IndexField"].defaultValue);
     104  }
     105 
     106}
     107
     108bool mgppqueryfilterclass::init (ostream &logout) {
     109 
     110  if (!queryfilterclass::init(logout)) {
     111    return false;
     112  }
     113 
     114  if (filterOptions["IndexField"].defaultValue.empty()) {
     115    // use first index in map as default if no default is set explicitly
     116    text_tarray fromarray;
     117    indexfieldmap.getfromarray(fromarray);
     118    if (fromarray.size()) {
     119      filterOptions["IndexField"].defaultValue = fromarray[0];
     120    }
     121  }
     122  return true;
     123}
    119124
    120125void mgppqueryfilterclass::filter(const FilterRequest_t &request,
  • trunk/gsdl/src/colservr/mgppqueryfilter.h

    r1835 r10954  
    5050
    5151  void configure (const text_t &key, const text_tarray &cfgline);
    52 
     52  bool init (ostream &logout);
    5353  void filter (const FilterRequest_t &request,
    5454               FilterResponse_t &response,
  • trunk/gsdl/src/colservr/queryfilter.h

    r9937 r10954  
    7878
    7979  virtual void configure (const text_t &key, const text_tarray &cfgline);
    80   bool init (ostream &logout);
     80  virtual bool init (ostream &logout);
    8181
    8282  text_t get_filter_name () {return "QueryFilter";}
Note: See TracChangeset for help on using the changeset viewer.