Changeset 4220 for trunk/gsdl/src/recpt
- Timestamp:
- 2003-05-01T14:38:08+12:00 (21 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/queryaction.cpp
r4200 r4220 1077 1077 return true; 1078 1078 } 1079 bool syntax_error = false; 1079 1080 1080 1081 set_queryfilter_options (request, formattedstring, args); … … 1134 1135 // do the query 1135 1136 collectproto->filter (*col_here, request, response, err, logout); 1136 if (err != noError ) {1137 if (err != noError && err != syntaxError) { 1137 1138 outconvertclass text_t2ascii; 1138 1139 logout << text_t2ascii … … 1142 1143 } 1143 1144 1145 if (err == syntaxError) { 1146 syntax_error = true; 1147 freqmsg = "_textinvalidquery_"; 1148 // assume the syntax will be invalid for all colls 1149 break; 1150 } 1144 1151 if (isApprox == Exact) 1145 1152 isApprox = response.isApprox; … … 1185 1192 << "_query:content_"; 1186 1193 1187 // now go through each result and output it 1188 QueryResult_tset::iterator res_here = results.begin(); 1189 QueryResult_tset::iterator res_end = results.end(); 1190 text_tset metadata; // empty !! 1191 bool getParents = false; // don't care !! 1192 bool use_table; 1193 ResultDocInfo_t thisdoc; 1194 format_t *formatlistptr = NULL; 1195 browserclass *browserptr = NULL; 1196 1197 int count = 1; 1198 int firstdoc = args.getintarg("r"); 1199 int hitsperpage = args.getintarg("o"); 1200 int thislast = firstdoc + (hitsperpage - 1); 1201 1202 // output results 1203 while (res_here != res_end) { 1204 if (count < firstdoc) {count ++; res_here ++; continue;} 1205 if (count > thislast) break; 1206 formatlistptr = colinfomap[(*res_here).collection].formatlistptr; 1207 browserptr = colinfomap[(*res_here).collection].browserptr; 1208 thisdoc = (*res_here).doc; 1209 use_table = is_table_content (formatlistptr); 1210 1211 collectproto = protos->getrecptproto ((*res_here).collection, logout); 1212 if (collectproto == NULL) { 1213 logout << outconvert << "queryaction::search_multiple_collections: " << (*res_here).collection 1214 << " collection has a NULL collectproto, ignoring results\n"; 1194 if (!syntax_error) { 1195 1196 // now go through each result and output it 1197 QueryResult_tset::iterator res_here = results.begin(); 1198 QueryResult_tset::iterator res_end = results.end(); 1199 text_tset metadata; // empty !! 1200 bool getParents = false; // don't care !! 1201 bool use_table; 1202 ResultDocInfo_t thisdoc; 1203 format_t *formatlistptr = NULL; 1204 browserclass *browserptr = NULL; 1205 1206 int count = 1; 1207 int firstdoc = args.getintarg("r"); 1208 int hitsperpage = args.getintarg("o"); 1209 int thislast = firstdoc + (hitsperpage - 1); 1210 1211 // output results 1212 while (res_here != res_end) { 1213 if (count < firstdoc) {count ++; res_here ++; continue;} 1214 if (count > thislast) break; 1215 formatlistptr = colinfomap[(*res_here).collection].formatlistptr; 1216 browserptr = colinfomap[(*res_here).collection].browserptr; 1217 thisdoc = (*res_here).doc; 1218 use_table = is_table_content (formatlistptr); 1219 1220 collectproto = protos->getrecptproto ((*res_here).collection, logout); 1221 if (collectproto == NULL) { 1222 logout << outconvert << "queryaction::search_multiple_collections: " << (*res_here).collection 1223 << " collection has a NULL collectproto, ignoring results\n"; 1224 res_here ++; 1225 continue; 1226 } 1227 1228 browserptr->output_section_group (thisdoc, args, (*res_here).collection, 0, 1229 formatlistptr, use_table, metadata, getParents, 1230 collectproto, disp, outconvert, textout, logout); 1231 // textout << outconvert << "(ranking: " << (*res_here).doc.ranking << ")\n"; 1215 1232 res_here ++; 1216 continue; 1217 } 1218 1219 browserptr->output_section_group (thisdoc, args, (*res_here).collection, 0, 1220 formatlistptr, use_table, metadata, getParents, 1221 collectproto, disp, outconvert, textout, logout); 1222 // textout << outconvert << "(ranking: " << (*res_here).doc.ranking << ")\n"; 1223 res_here ++; 1224 count ++; 1225 } 1226 1233 count ++; 1234 } 1235 } 1227 1236 textout << outconvert << disp << "_query:footer_"; 1228 1237 … … 1288 1297 set_queryfilter_options (request, formattedstring, args); 1289 1298 collectproto->filter (collection, request, response, err, logout); 1290 if (err != noError ) {1299 if (err != noError && err != syntaxError) { 1291 1300 outconvertclass text_t2ascii; 1292 1301 logout << text_t2ascii … … 1295 1304 return false; 1296 1305 } 1297 1306 1307 bool syntax_error = false; 1308 if (err == syntaxError) syntax_error = true; 1309 //return false; 1298 1310 define_query_macros (args, disp, response.numDocs, response.isApprox); 1299 define_single_query_macros(args, disp, response );1311 define_single_query_macros(args, disp, response, syntax_error); 1300 1312 1301 1313 // save the query if appropriate … … 1432 1444 void queryaction::define_single_query_macros (cgiargsclass &args, 1433 1445 displayclass &disp, 1434 const FilterResponse_t &response) { 1435 // set up _freqmsg_ and _quotedquery_ macros 1436 text_t freqmsg = "_textfreqmsg1_"; 1437 TermInfo_tarray::const_iterator this_term = response.termInfo.begin(); 1438 TermInfo_tarray::const_iterator end_term = response.termInfo.end(); 1439 while (this_term != end_term) { 1440 freqmsg += (*this_term).term + ": " + (*this_term).freq; 1441 if ((this_term + 1) != end_term) 1442 freqmsg += ", "; 1443 this_term ++; 1446 const FilterResponse_t &response, 1447 bool syntax_error) { 1448 // set up _freqmsg_ and _quotedquery_ macros 1449 1450 text_t freqmsg = ""; 1451 if (syntax_error) { 1452 freqmsg = "_textinvalidquery_"; 1453 } else { 1454 freqmsg = "_textfreqmsg1_"; 1455 TermInfo_tarray::const_iterator this_term = response.termInfo.begin(); 1456 TermInfo_tarray::const_iterator end_term = response.termInfo.end(); 1457 while (this_term != end_term) { 1458 freqmsg += (*this_term).term + ": " + (*this_term).freq; 1459 if ((this_term + 1) != end_term) 1460 freqmsg += ", "; 1461 this_term ++; 1462 } 1444 1463 } 1445 1464 disp.setmacro ("freqmsg", "query", freqmsg); -
trunk/gsdl/src/recpt/queryaction.h
r4200 r4220 68 68 virtual void define_single_query_macros (cgiargsclass &args, 69 69 displayclass &disp, 70 const FilterResponse_t &response); 70 const FilterResponse_t &response, 71 bool syntax_error); 71 72 virtual void define_query_macros (cgiargsclass &args, displayclass &disp, 72 73 int numDocs, isapprox isApprox);
Note:
See TracChangeset
for help on using the changeset viewer.