Ignore:
Timestamp:
2009-09-28T14:59:17+13:00 (15 years ago)
Author:
kjdon
Message:

added support for defaultlevel in collect.cfg, for mgpp and lucene. also added defaultindex for lucene

File:
1 edited

Legend:

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

    r16445 r20727  
    4545  filtopt.type = FilterOption_t::enumeratedt;
    4646  filtopt.repeatable = FilterOption_t::onePerTerm;
     47  filtopt.defaultValue = "";
    4748  filterOptions["Level"] = filtopt;
    4849
     
    7172  if (key == "indexfieldmap") {
    7273    indexfieldmap.importmap (cfgline);
    73    
    74     // update the list of indexes in the filter information
    7574    text_tarray options;
    7675    indexfieldmap.gettoarray (options);
    7776    filterOptions["IndexField"].validValues = options;
    7877   
     78  } else if (key == "levelmap") {
     79    levelmap.importmap (cfgline);
    7980  } else if (key == "indexlevels") {
     81    filterOptions["Level"].validValues.erase(filterOptions["Level"].validValues.begin(), filterOptions["Level"].validValues.end());
    8082    text_tarray::const_iterator here = cfgline.begin();
    8183    text_tarray::const_iterator end = cfgline.end();
    82     bool first=true;
    83     filterOptions["Level"].validValues.erase(filterOptions["Level"].validValues.begin(), filterOptions["Level"].validValues.end());
    8484    while (here != end) {
    8585      if (!(*here).empty()) {
    86     if (first) {
    87       first = false;
    88       // the default is the first value
    89       filterOptions["Level"].defaultValue = *here;
    90     }
    9186    filterOptions["Level"].validValues.push_back(*here);
    9287      }
     
    9994  } else if (key == "defaultindex") { // used for fields in mgpp
    10095    indexfieldmap.from2to (cfgline[0], filterOptions["IndexField"].defaultValue);
     96  } else if (key == "defaultlevel") {
     97    levelmap.from2to (cfgline[0], filterOptions["Level"].defaultValue);
    10198  }
    10299 
     
    117114    }
    118115  }
     116  if (filterOptions["Levels"].defaultValue.empty()) {
     117    // use first level as default if no default is set explicitly
     118    if (!filterOptions["Level"].validValues[0].empty())
     119      filterOptions["Levels"].defaultValue = filterOptions["Level"].validValues[0];
     120  }
     121
    119122  return true;
    120123}
Note: See TracChangeset for help on using the changeset viewer.