Changeset 23380 for main/trunk/greenstone2/runtime-src
- Timestamp:
- 2010-12-03T16:40:35+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/recpt/queryaction.cpp
r23378 r23380 1010 1010 map<text_t, int, lttext_t> termfreqs; 1011 1011 1012 ColInfoResponse_t *tmp_cinfo; 1012 1013 while (col_here != col_end) { 1013 1014 … … 1020 1021 continue; 1021 1022 } 1022 cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout);1023 if ( cinfo == NULL) {1023 tmp_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout); 1024 if (tmp_cinfo == NULL) { 1024 1025 // skip this collection 1025 1026 logout << "ERROR (query_action::search_multiple_collections): get_collectinfo_ptr returned NULL\n"; … … 1035 1036 // get the formatstring if there is one 1036 1037 if (!get_formatstring (classification, browsertype, 1037 cinfo->format, formatstring)) {1038 tmp_cinfo->format, formatstring)) { 1038 1039 formatstring = bptr->get_default_formatstring(); 1039 1040 } … … 1101 1102 } // for each coll 1102 1103 1104 // now we have an ordered list of results. If ifl (I feel lucky) is set, then pick out the one we want 1105 if (args["ifl"] == 1 || (args["ifl"] == 2 && numdocs == 1)) { 1106 1107 //Find whether DocumentSearchResultLinks is enabled 1108 bool show_links = false; 1109 text_tmap::const_iterator format_here = cinfo->format.begin(); 1110 text_tmap::const_iterator format_end = cinfo->format.end(); 1111 1112 while (format_here != format_end) { 1113 if (((*format_here).first == "DocumentSearchResultLinks") && 1114 ((*format_here).second == "true")){ 1115 show_links = true; 1116 break; 1117 } 1118 ++format_here; 1119 } 1120 1121 // which doc do we want? 1122 int docnum; 1123 int ifl; 1124 int srn = 0; 1125 int srp = 0; 1126 if (args["ifl"] == 1) { 1127 ifl = args["ifln"].getint(); 1128 docnum = ifl - 1; 1129 if (show_links) { 1130 // set the values for next and prev search result number 1131 srn = ifl + 1; 1132 if (srn > numdocs) { 1133 srn = 0; 1134 } 1135 srp = ifl - 1; 1136 if (srp < 0) { 1137 srp = 0; 1138 } 1139 } 1140 } else { 1141 // we just want the first (and only) result 1142 docnum = 0; 1143 } 1144 1145 if (docnum >= 0 && docnum < numdocs) { 1146 // get the docnum'th item from the results 1147 QueryResult_tset::iterator res_here = results.begin(); 1148 for (int i=0; i< docnum; i++) { 1149 ++res_here; 1150 } 1151 1152 textout << outconvert << disp 1153 << "Location: _gwcgi_?e=_compressedoptions_&a=d&c=" 1154 << (*res_here).collection << "&cl=search&d=" << (*res_here).doc.OID 1155 << "&srn=" << srn << "&srp=" << srp << "\n\n"; 1156 textout << flush; 1157 1158 return true; 1159 1160 } 1161 } 1162 1163 if (!args["ifl"].empty()) { 1164 // if we get here, and ifl was set but we haven't output a document, then we'll carry on as if ifl wasn't set. The only catch is that get_cgihead_info won't have 1165 // done the right thing (because ifl was set), so we need to make sure the output is html 1166 textout << "Content-type: text/html\n\n"; 1167 } 1168 1169 1103 1170 text_t numdocs_t = numdocs; 1104 1171 args["nmd"] = numdocs_t;
Note:
See TracChangeset
for help on using the changeset viewer.