Changeset 20727
- Timestamp:
- 2009-09-28T14:59:17+13:00 (15 years ago)
- Location:
- gsdl/trunk/runtime-src/src/colservr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/runtime-src/src/colservr/lucenequeryfilter.cpp
r16947 r20727 45 45 filtopt.type = FilterOption_t::enumeratedt; 46 46 filtopt.repeatable = FilterOption_t::onePerTerm; 47 filtopt.defaultValue = ""; 47 48 filterOptions["Level"] = filtopt; 48 49 … … 75 76 text_tarray options; 76 77 indexfieldmap.gettoarray (options); 77 78 text_tarray::const_iterator here = options.begin(); 79 text_tarray::const_iterator end = options.end(); 80 bool start = true; 81 while (here !=end) { 82 if (!(*here).empty()) { 83 filterOptions["IndexField"].validValues.push_back(*here); 84 if (start) { 85 filterOptions["IndexField"].defaultValue = *here; 86 start = false; 87 } 88 } 89 ++here; 90 } 78 filterOptions["IndexField"].validValues = options; 79 } else if (key == "levelmap") { 80 levelmap.importmap (cfgline); 91 81 } else if (key == "indexlevels") { 92 82 text_tarray::const_iterator here = cfgline.begin(); 93 83 text_tarray::const_iterator end = cfgline.end(); 94 bool first=true;95 84 while (here != end) { 96 85 if (!(*here).empty()) { 97 if (first) {98 first = false;99 // the default is the first value100 filterOptions["Level"].defaultValue = *here;101 }102 86 filterOptions["Level"].validValues.push_back(*here); 103 87 } … … 106 90 } else if (key == "textlevel") { 107 91 ((lucenesearchclass *)textsearchptr)->set_text_level(cfgline[0]); 108 } 109 110 } 111 92 } else if (key == "defaultindex") { 93 indexfieldmap.from2to (cfgline[0], filterOptions["IndexField"].defaultValue); 94 } else if (key == "defaultlevel") { 95 levelmap.from2to (cfgline[0], filterOptions["Level"].defaultValue); 96 } 97 98 } 99 100 bool lucenequeryfilterclass::init (ostream &logout) { 101 102 if (!queryfilterclass::init(logout)) { 103 return false; 104 } 105 106 if (filterOptions["IndexField"].defaultValue.empty()) { 107 // use first index in map as default if no default is set explicitly 108 text_tarray fromarray; 109 indexfieldmap.getfromarray(fromarray); 110 if (fromarray.size()) { 111 filterOptions["IndexField"].defaultValue = fromarray[0]; 112 } 113 } 114 if (filterOptions["Levels"].defaultValue.empty()) { 115 // use first level as default if no default is set explicitly 116 if (!filterOptions["Level"].validValues[0].empty()) 117 filterOptions["Levels"].defaultValue = filterOptions["Level"].validValues[0]; 118 } 119 120 return true; 121 } 112 122 113 123 void lucenequeryfilterclass::filter(const FilterRequest_t &request, -
gsdl/trunk/runtime-src/src/colservr/lucenequeryfilter.h
r15558 r20727 36 36 37 37 stringmap indexfieldmap; 38 stringmap levelmap; 39 38 40 bool full_text_browse (int filterRequestOptions); 39 41 … … 50 52 51 53 void configure (const text_t &key, const text_tarray &cfgline); 52 54 bool init (ostream &logout); 53 55 void filter (const FilterRequest_t &request, 54 56 FilterResponse_t &response, -
gsdl/trunk/runtime-src/src/colservr/mgppqueryfilter.cpp
r16445 r20727 45 45 filtopt.type = FilterOption_t::enumeratedt; 46 46 filtopt.repeatable = FilterOption_t::onePerTerm; 47 filtopt.defaultValue = ""; 47 48 filterOptions["Level"] = filtopt; 48 49 … … 71 72 if (key == "indexfieldmap") { 72 73 indexfieldmap.importmap (cfgline); 73 74 // update the list of indexes in the filter information75 74 text_tarray options; 76 75 indexfieldmap.gettoarray (options); 77 76 filterOptions["IndexField"].validValues = options; 78 77 78 } else if (key == "levelmap") { 79 levelmap.importmap (cfgline); 79 80 } else if (key == "indexlevels") { 81 filterOptions["Level"].validValues.erase(filterOptions["Level"].validValues.begin(), filterOptions["Level"].validValues.end()); 80 82 text_tarray::const_iterator here = cfgline.begin(); 81 83 text_tarray::const_iterator end = cfgline.end(); 82 bool first=true;83 filterOptions["Level"].validValues.erase(filterOptions["Level"].validValues.begin(), filterOptions["Level"].validValues.end());84 84 while (here != end) { 85 85 if (!(*here).empty()) { 86 if (first) {87 first = false;88 // the default is the first value89 filterOptions["Level"].defaultValue = *here;90 }91 86 filterOptions["Level"].validValues.push_back(*here); 92 87 } … … 99 94 } else if (key == "defaultindex") { // used for fields in mgpp 100 95 indexfieldmap.from2to (cfgline[0], filterOptions["IndexField"].defaultValue); 96 } else if (key == "defaultlevel") { 97 levelmap.from2to (cfgline[0], filterOptions["Level"].defaultValue); 101 98 } 102 99 … … 117 114 } 118 115 } 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 119 122 return true; 120 123 } -
gsdl/trunk/runtime-src/src/colservr/mgppqueryfilter.h
r15595 r20727 36 36 37 37 stringmap indexfieldmap; 38 stringmap levelmap; 39 38 40 bool full_text_browse (int filterRequestOptions); 39 41
Note:
See TracChangeset
for help on using the changeset viewer.