Changeset 4808


Ignore:
Timestamp:
2003-06-25T15:37:48+12:00 (21 years ago)
Author:
kjdon
Message:

the level filteroption is now initialized from indexlevels and textlevel from build.cfg, not using levels from collect.cfg. this means it will not work with old colls. but it no longer assumes anything about what levels are available

File:
1 edited

Legend:

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

    r4752 r4808  
    4343 
    4444  // -- onePerTerm  Level          enumerated
    45   // Document, Section, Paragraph
     45  // likely to be Doc, Sec, Para, but we dont assume anything now
    4646  filtopt.clear();
    4747  filtopt.name = "Level";
    4848  filtopt.type = FilterOption_t::enumeratedt;
    4949  filtopt.repeatable = FilterOption_t::onePerTerm;
    50   filtopt.validValues.push_back("Document");
    51   filtopt.defaultValue = "Document";
    5250  filterOptions["Level"] = filtopt;
    5351
     
    9492      here++;
    9593    }
    96   }
    97 
    98   if (key == "levels") {
    99     // if levels has been specified, we remove the default Document from valid values - currently, it is the only one - not yet
    100     //filterOptions["Level"].validValues.erase(0);
     94  } else if (key == "indexlevels") {
    10195    text_tarray::const_iterator here = cfgline.begin();
    10296    text_tarray::const_iterator end = cfgline.end();
    103    
     97    bool first=true;
    10498    while (here != end) {
    10599      if (!(*here).empty()) {
    106     if ((*here) == "section" || (*here) == "Section") {
    107       filterOptions["Level"].validValues.push_back("Section");
    108       filterOptions["Level"].defaultValue = "Section";
    109       text_t sect = "Section";
    110       ((mgppsearchclass *)mgsearchptr)->set_gdbm_level(sect);
    111     } else if ((*here) == "document" || (*here) == "Document") {
    112       //filterOptions["Level"].validValues.push_back("Document");
    113     } else if ((*here) == "paragraph" || (*here) == "Paragraph") {
    114       filterOptions["Level"].validValues.push_back("Paragraph");
    115     }
    116       }
    117       here++;
    118     }
    119     // just check to make sure that there have been some levels specified
    120     // if (filterOptions["Level"].validValues.empty()) {
    121       // add back in document
    122     // filterOptions["Level"].validValues.push_back("Document");
    123     // }
    124    
    125   }
     100    if (first) {
     101      first = false;
     102      // the default is the first value
     103      filterOptions["Level"].defaultValue = *here;
     104    }
     105    filterOptions["Level"].validValues.push_back(*here);
     106      }
     107      here ++;
     108    }
     109  } else if (key == "textlevel") {
     110      ((mgppsearchclass *)mgsearchptr)->set_gdbm_level( cfgline[0]);
     111  }
     112 
    126113}
    127114
Note: See TracChangeset for help on using the changeset viewer.