Changeset 27362

Show
Ignore:
Timestamp:
16.05.2013 15:39:57 (6 years ago)
Author:
kjdon
Message:

slightly changed the handling of sortfield query option

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/queryaction.cpp

    r27172 r27362  
    558558    } 
    559559    set_option_macro ("fqf", args["fqf"], true, form_search, (*it).second, disp); 
    560     if (args["ct"] == "2") {// lucene 
     560      } 
     561      if (args["ct"] == "2") {// lucene 
     562    it = response.filterOptions.find("SortField"); 
    561563      // set the sort field macro 
    562564      set_sfselection_macro(args["sf"], (*it).second, disp); 
    563565    } 
    564566      } 
    565     } 
     567   
    566568 
    567569    // add a queryterms macro for plain version of search terms 
     
    591593                       displayclass &disp) { 
    592594 
    593   // we need at least one option here to continue 
    594   if (option.validValues.size() < 1) { 
     595  // we need at least two options here to continue 
     596  if (option.validValues.size() < 2) { 
    595597    return; 
    596598  } 
     
    600602  if (current_value.empty()) current_value = ""; 
    601603   
    602   // we give a rank option first 
    603   macrovalue += "<option value=\"\""; 
    604   if (current_value == "") { 
    605     macrovalue += " selected"; 
    606   } 
    607   macrovalue += ">_query:textsortbyrank_\n"; 
    608  
    609604  text_tarray::const_iterator thisvalue = option.validValues.begin(); 
    610605  text_tarray::const_iterator endvalue = option.validValues.end(); 
    611   int valid_count = 0; 
     606  //  int valid_count = 0; 
    612607  while (thisvalue != endvalue) { 
    613     if (*thisvalue != "ZZ" && *thisvalue != "TX") { 
    614       ++valid_count; 
    615       macrovalue += "<option value=\"by" + *thisvalue + "\""; 
    616       if (current_value == "by"+*thisvalue) 
     608    if (*thisvalue == "rank") { 
     609       macrovalue += "<option value=\"rank\""; 
     610       if (current_value == "rank") { 
     611     macrovalue += " selected"; 
     612       } 
     613       macrovalue += ">_query:textsortbyrank_\n"; 
     614    } else { 
     615      macrovalue += "<option value=\"" + *thisvalue + "\""; 
     616      if (current_value == *thisvalue) 
    617617    macrovalue += " selected"; 
    618618      macrovalue += ">_" + *thisvalue + "_\n"; 
     
    620620    ++thisvalue; 
    621621  } 
    622   macrovalue += "</select>"; 
    623   if (valid_count > 0) { 
    624     disp.setmacro ("sfselection", displayclass::defaultpackage, macrovalue); 
    625   } 
    626    
    627 } 
    628   
     622  macrovalue += "</select>";   
     623  disp.setmacro ("sfselection", displayclass::defaultpackage, macrovalue); 
     624   
     625} 
     626 
    629627// sets the selection box macro _gformselection_. 
    630628// the default for _gformselection_ is _gselection_