Show
Ignore:
Timestamp:
14.03.2013 12:46:15 (7 years ago)
Author:
kjdon
Message:

more tidying up of queryfilters. moved some stuff to the lucene class, and added 'virtual's so the right method actually gets used

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/colservr/queryfilter.cpp

    r27064 r27084  
    264264 
    265265void queryfilterclass::set_queryparam_defaults(queryparamclass &query ) { 
    266    
     266 
    267267  query.collection = collection; 
    268268  query.index = filterOptions["Index"].defaultValue; 
     
    281281} 
    282282 
    283 bool queryfilterclass::set_queryparam_field(OptionValue_t option, queryparamclass &query) { 
    284  
    285 if (option.name == "QueryType") { 
    286       query.search_type = (option.value == "ranked"); 
    287     } else if (option.name == "MatchMode") { 
    288       query.match_mode = (option.value == "all"); 
    289       if (query.match_mode == 1) query.maxdocs = -1; 
    290     } else if (option.name == "Term") { 
    291       query.querystring = option.value; 
    292     } else if (option.name == "Casefold") { 
    293       query.casefolding = (option.value == "true"); 
    294     } else if (option.name == "Stem") { 
    295       query.stemming = (option.value == "true"); 
    296     } else if (option.name == "AccentFold") { 
    297       query.accentfolding = (option.value == "true"); 
    298     } else if (option.name == "Index"&& option.value !="") { 
    299       query.index = option.value; 
    300     } else if (option.name == "Subcollection") { 
    301       query.subcollection = option.value; 
    302     } else if (option.name == "Language") { 
    303       query.language = option.value; 
    304     } else if (option.name == "Maxdocs") { 
    305       query.maxdocs = option.value.getint(); 
    306     // } else if (option.name == "PhraseMatch") { 
    307     //   phrasematch = option.value; 
    308     } else if (option.name == "Level") { 
    309       query.level = option.value; 
    310     } else if (option.name == "FilterString") { 
    311       query.filterstring = option.value; 
    312     } else if (option.name == "SortField") { 
    313       query.sortfield = option.value; 
    314     } else if (option.name == "SortOrder") { 
    315       query.sortorder = (option.value == "descending"); 
    316     } else if (option.name == "Fuzziness") { 
    317       query.fuzziness = option.value; 
    318  }  
     283bool queryfilterclass::set_queryparam_field(const OptionValue_t &option, queryparamclass &query) { 
     284 
     285  if (option.name == "QueryType") { 
     286    query.search_type = (option.value == "ranked"); 
     287    return true; 
     288  }  
     289  if (option.name == "MatchMode") { 
     290    query.match_mode = (option.value == "all"); 
     291    if (query.match_mode == 1) query.maxdocs = -1; 
     292    return true; 
     293  } 
     294  if (option.name == "Term") { 
     295    query.querystring = option.value; 
     296    return true; 
     297  } 
     298  if (option.name == "Casefold") { 
     299    query.casefolding = (option.value == "true"); 
     300    return true; 
     301  } 
     302  if (option.name == "Stem") { 
     303    query.stemming = (option.value == "true"); 
     304    return true; 
     305  } 
     306  if (option.name == "AccentFold") { 
     307    query.accentfolding = (option.value == "true"); 
     308    return true; 
     309  } 
     310  if (option.name == "Index"&& option.value !="") { 
     311    query.index = option.value; 
     312    return true; 
     313  } 
     314  if (option.name == "Subcollection") { 
     315    query.subcollection = option.value; 
     316    return true; 
     317  } 
     318  if (option.name == "Language") { 
     319    query.language = option.value; 
     320    return true; 
     321  } 
     322  if (option.name == "Maxdocs") { 
     323    query.maxdocs = option.value.getint(); 
     324    return true; 
     325  } 
     326  if (option.name == "Level") { 
     327    query.level = option.value; 
     328    return true; 
     329  } 
     330 
     331  return false; 
    319332} 
    320333// get the query parameters 
     
    324337                       ostream &logout) { 
    325338  outconvertclass text_t2ascii; 
    326  
    327339  // set defaults for the return parameters 
    328340  query_params.erase(query_params.begin(), query_params.end());