Changeset 13127
- Timestamp:
- 2006-10-18T17:02:02+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractMGPPSearch.java
r13124 r13127 68 68 private static final String FIELD_STEM_PARAM = "fqs"; 69 69 private static final String FIELD_CASE_PARAM = "fqc"; 70 private static final String FIELD_ACCENT_PARAM="fqa"; 70 71 private static final String FIELD_FIELD_PARAM = "fqf"; 71 72 private static final String FIELD_COMBINE_PARAM = "fqk"; … … 73 74 private static final String FIELD_COMBINE_PARAM_OR = "1"; 74 75 private static final String FIELD_COMBINE_PARAM_NOT = "2"; 76 77 private static final String ACCENT_PARAM="accent"; 75 78 76 79 // some stuff for config files … … 84 87 protected static final String LEVEL_ELEM = "level"; 85 88 89 protected static final String STEMINDEX_OPTION = "stemIndexes"; 90 protected static final String MAXNUMERIC_OPTION = "maxnumeric"; 91 86 92 protected static final String EQUIV_TERM_ELEM = "equivTerm"; 87 93 … … 106 112 private boolean advanced_form_search = false; 107 113 114 // stem indexes available 115 private boolean does_case=true; 116 private boolean does_stem=true; 117 private boolean does_accent=false; 118 119 // maxnumeric - not used yet. needs to be passed to MGPPWrapper. 120 private int maxnumeric = 4; 121 108 122 /** the stem used for the index files */ 109 123 protected String index_stem = null; … … 142 156 } 143 157 if (this.index_stem == null || this.index_stem.equals("")) { 144 logger. error("AbstractMGPPSearch.configure(): indexStem element not found, stem will default to collection name");158 logger.warn("AbstractMGPPSearch.configure(): indexStem element not found, stem will default to collection name"); 145 159 this.index_stem = this.cluster_name; 160 } 161 162 // get index options 163 Element index_option_list = (Element) GSXML.getChildByTagName(info, GSXML.INDEX_OPTION_ELEM + GSXML.LIST_MODIFIER); 164 if (index_option_list != null) { 165 NodeList options = index_option_list.getElementsByTagName(GSXML.INDEX_OPTION_ELEM); 166 for (int i=0; i<options.getLength(); i++) { 167 Element opt = (Element)options.item(i); 168 String name = opt.getAttribute(GSXML.NAME_ATT); 169 String value = opt.getAttribute(GSXML.VALUE_ATT); 170 if (name.equals(MAXNUMERIC_OPTION)) { 171 int maxnum = Integer.parseInt(value); 172 if (4 <= maxnum && maxnum < 512) { 173 maxnumeric = maxnum; 174 } 175 } 176 else if (name.equals(STEMINDEX_OPTION)) { 177 int stemindex = Integer.parseInt(value); 178 // stem and case are true by default, accent folding false by defualt 179 if ((stemindex & 1) == 0) { 180 does_case = false; 181 } 182 if ((stemindex & 2) == 0) { 183 does_stem = false; 184 } 185 if ((stemindex & 4) != 0) { 186 does_accent = true; 187 } 188 } 189 } 146 190 } 147 191 … … 295 339 param_list.appendChild(multiparam); 296 340 297 createParameter(FIELD_COMBINE_PARAM, multiparam, lang); 298 createParameter(FIELD_QUERY_PARAM, multiparam, lang); 299 createParameter(FIELD_CASE_PARAM, multiparam, lang); 300 createParameter(FIELD_STEM_PARAM, multiparam, lang); 301 createParameter(FIELD_FIELD_PARAM, multiparam, lang); 341 createParameter(FIELD_COMBINE_PARAM, multiparam, lang); 342 createParameter(FIELD_QUERY_PARAM, multiparam, lang); 343 if (this.does_case) { 344 createParameter(FIELD_CASE_PARAM, multiparam, lang); 345 } 346 if (this.does_stem) { 347 createParameter(FIELD_STEM_PARAM, multiparam, lang); 348 } 349 if (this.does_accent) { 350 createParameter(FIELD_ACCENT_PARAM, multiparam, lang); 351 } 352 createParameter(FIELD_FIELD_PARAM, multiparam, lang); 302 353 303 354 } … … 311 362 { 312 363 createParameter(LEVEL_PARAM, param_list, lang); 313 createParameter(CASE_PARAM, param_list, lang); 314 createParameter(STEM_PARAM, param_list, lang); 364 if (this.does_case){ 365 createParameter(CASE_PARAM, param_list, lang); 366 } 367 if (this.does_stem){ 368 createParameter(STEM_PARAM, param_list, lang); 369 } 370 if (this.does_accent){ 371 createParameter(ACCENT_PARAM, param_list, lang); 372 } 315 373 createParameter(MATCH_PARAM, param_list, lang); 316 374 createParameter(RANK_PARAM, param_list, lang); 317 318 375 } 319 376 … … 341 398 342 399 343 } else if (name.equals(FIELD_CASE_PARAM) || name.equals(FIELD_STEM_PARAM) ) {400 } else if (name.equals(FIELD_CASE_PARAM) || name.equals(FIELD_STEM_PARAM) || name.equals(FIELD_ACCENT_PARAM)) { 344 401 String[] bool_ops = {"0", "1"}; 345 402 String[] bool_texts = {getTextString("param.boolean.off", lang, "AbstractSearch"),getTextString("param.boolean.on", lang, "AbstractSearch")};
Note:
See TracChangeset
for help on using the changeset viewer.