Changeset 12786
- Timestamp:
- 2006-09-20T09:55:47+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/queryaction.cpp
r12771 r12786 672 672 673 673 674 675 674 void queryaction::define_external_macros (displayclass &disp, cgiargsclass &args, 676 675 recptprotolistclass *protos, ostream &logout) { … … 737 736 it = response.filterOptions.find("IndexField"); 738 737 if (it!=end) { 739 if (args["qto"]=="2" || args["qt"]=="1") { // form search 740 set_option_macro ("fqf", args["fqf"], true, true, (*it).second, disp); 741 } else { 742 set_option_macro ("fqf", args["fqf"], true, false, (*it).second, disp); 738 bool form_search = false; 739 if (args["qto"]=="2" || args["qt"]=="1") { 740 form_search = true; 741 } 742 set_option_macro ("fqf", args["fqf"], true, form_search, (*it).second, disp); 743 if (args["ct"] == "2") {// lucene 744 // set the sort field macro 745 set_sfselection_macro(args["sf"], (*it).second, disp); 743 746 } 744 747 } … … 746 749 } 747 750 } // define external macros 748 751 752 void queryaction::set_sfselection_macro(text_t current_value, 753 const FilterOption_t &option, 754 displayclass &disp) { 755 756 // we need two or more options to continue 757 if (option.validValues.size() <= 2) { 758 return; 759 } 760 761 text_t macrovalue = "<select name=\"sf\">\n"; 762 763 if (current_value.empty()) current_value = ""; 764 765 // we give a rank option first 766 macrovalue += "<option value=\"\""; 767 if (current_value == "") { 768 macrovalue += " selected"; 769 } 770 macrovalue += ">_query:textsortbyrank_\n"; 771 772 text_tarray::const_iterator thisvalue = option.validValues.begin(); 773 text_tarray::const_iterator endvalue = option.validValues.end(); 774 int valid_count = 0; 775 while (thisvalue != endvalue) { 776 if (*thisvalue != "ZZ" && *thisvalue != "TX") { 777 ++valid_count; 778 macrovalue += "<option value=\"by" + *thisvalue + "\""; 779 if (current_value == "by"+*thisvalue) 780 macrovalue += " selected"; 781 macrovalue += ">_" + *thisvalue + "_\n"; 782 } 783 ++thisvalue; 784 } 785 macrovalue += "</select>"; 786 if (valid_count > 0) { 787 disp.setmacro ("sfselection", displayclass::defaultpackage, macrovalue); 788 } 789 790 } 791 749 792 // sets the selection box macro _gformselection_. 750 793 // the default for _gformselection_ is _gselection_ … … 809 852 return; // dont need these macros 810 853 811 // mgpp & form query only needs the macros defined812 854 text_t form = ""; 813 855 int argfqn = args.getintarg("fqn"); 814 856 815 857 if (args["b"] == "1") { // advanced form 816 form += " <tr>_firstadvformelement_</tr>\n";858 form += "_firstadvformelement_\n"; 817 859 for (int i=1; i<argfqn; ++i) { 818 form += " <tr>_advformelement_</tr>\n";860 form += "_advformelement_\n"; 819 861 } 820 862 disp.setmacro("advformlist", "query", form); … … 822 864 else { // simple form 823 865 for (int i=0; i<argfqn; ++i) { 824 form += " <tr>_regformelement_</tr>\n";866 form += "_regformelement_\n"; 825 867 } 826 868 disp.setmacro("regformlist", "query", form); … … 1365 1407 text_t formattedstring = ""; 1366 1408 get_formatted_query_string(formattedstring, segment, args, disp, logout); 1367 1409 1368 1410 if (!formattedstring.empty()) { // do the query 1369 1411 // note! formattedstring is in unicode! mg and mgpp must convert! … … 1452 1494 format_querystring (formattedstring, args.getintarg("b"), segment); 1453 1495 if (args["ct"]!=0) { // mgpp and lucene - need to add in tag info if appropriate 1454 format_field_info(formattedstring, args); 1496 format_field_info(formattedstring, args["fqf"], args.getintarg("ct"), 1497 args.getintarg("t"), args.getintarg("b")); 1455 1498 } 1456 1499 … … 1468 1511 else { // form search 1469 1512 if (args["b"]=="0") { // regular form 1470 parse_reg_query_form(formattedstring, args );1513 parse_reg_query_form(formattedstring, args, segment); 1471 1514 } 1472 1515 else { // advanced form 1473 parse_adv_query_form(formattedstring, args );1516 parse_adv_query_form(formattedstring, args, segment); 1474 1517 } 1475 1518 args["q"] = formattedstring;
Note:
See TracChangeset
for help on using the changeset viewer.