Changeset 9698 for trunk/gsdl/src/recpt
- Timestamp:
- 2005-04-15T16:51:11+12:00 (19 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/queryaction.cpp
r9620 r9698 1316 1316 set_queryfilter_options (request, formattedstring, args); 1317 1317 collectproto->filter (collection, request, response, err, logout); 1318 if (err != noError && err != syntaxError) {1318 if (err != noError) { 1319 1319 outconvertclass text_t2ascii; 1320 1320 logout << text_t2ascii 1321 1321 << "queryaction::search_single_collections: call to QueryFilter failed " 1322 1322 << "for " << collection << " collection (" << get_comerror_string (err) << ")\n"; 1323 return false; 1324 } 1325 1326 bool syntax_error = false; 1327 if (err == syntaxError) syntax_error = true; 1328 1329 if (!args["ifl"].empty()) { 1323 1324 } 1325 1326 if (err == noError && !args["ifl"].empty()) { 1330 1327 // Go directly to the first matching document 1331 1328 ResultDocInfo_tarray::iterator thissection = response.docInfo.begin(); … … 1359 1356 1360 1357 //return false; 1361 define_query_macros (args, disp, response.numDocs, response.isApprox); 1362 define_single_query_macros(args, disp, response, syntax_error); 1363 1364 // save the query if appropriate 1365 save_search_history(args, response.numDocs, response.isApprox); 1358 if (err != noError) { 1359 disp.setmacro("resultline", "query", "_textnodocs_"); 1360 if (err == syntaxError) { 1361 disp.setmacro ("freqmsg", "query", "_textinvalidquery_"); 1362 } else { 1363 disp.setmacro ("freqmsg", "query", ""); 1364 } 1365 } else { 1366 1367 define_query_macros (args, disp, response.numDocs, response.isApprox); 1368 define_single_query_macros(args, disp, response); 1369 // save the query if appropriate 1370 save_search_history(args, response.numDocs, response.isApprox); 1371 } 1366 1372 } 1367 1373 define_history_macros (disp, args, protos, logout); … … 1369 1375 textout << outconvert << disp << "_query:header_\n" 1370 1376 << "_query:content_"; 1371 1372 // output the results 1373 bool use_table = is_table_content (formatlistptr); 1374 bptr->output_section_group (response, args, collection, 0, formatlistptr, 1375 use_table, request.fields, request.getParents, 1376 collectproto, disp, outconvert, textout, logout); 1377 1377 1378 if (err == noError) { 1379 // output the results 1380 bool use_table = is_table_content (formatlistptr); 1381 bptr->output_section_group (response, args, collection, 0, formatlistptr, 1382 use_table, request.fields, request.getParents, 1383 collectproto, disp, outconvert, textout, logout); 1384 } 1378 1385 1379 1386 textout << outconvert << disp << "_query:footer_"; … … 1447 1454 // query had been done. Those macros are 1448 1455 // _resultline_, _nextfirst_, _nextlast_, _prevfirst_, _prevlast_, 1449 // _thisfirst_, and _thislast_ 1456 // _thisfirst_, and _thislast_ and _quotedquery_ 1450 1457 // this has been simplified so it can be used with both search_single_coll 1451 1458 // and search_multiple_coll … … 1525 1532 // define_single_query_macros sets the extra macros for search_single_coll 1526 1533 // that couldn't be set until the query had been done. Those macros are 1527 // _freqmsg_, _quotedquery_1534 // _freqmsg_, 1528 1535 void queryaction::define_single_query_macros (cgiargsclass &args, 1529 1536 displayclass &disp, 1530 const FilterResponse_t &response, 1531 bool syntax_error) { 1532 // set up _freqmsg_ and _quotedquery_ macros 1537 const FilterResponse_t &response) { 1538 // set up _freqmsg_ macros 1533 1539 1534 1540 text_t freqmsg = ""; 1535 if (syntax_error) { 1536 freqmsg = "_textinvalidquery_"; 1537 } else { 1538 freqmsg = "_textfreqmsg1_"; 1539 TermInfo_tarray::const_iterator this_term = response.termInfo.begin(); 1540 TermInfo_tarray::const_iterator end_term = response.termInfo.end(); 1541 while (this_term != end_term) { 1542 freqmsg += (*this_term).term + ": " + (*this_term).freq; 1543 if ((this_term + 1) != end_term) 1544 freqmsg += ", "; 1545 ++this_term; 1546 } 1547 } 1541 freqmsg = "_textfreqmsg1_"; 1542 TermInfo_tarray::const_iterator this_term = response.termInfo.begin(); 1543 TermInfo_tarray::const_iterator end_term = response.termInfo.end(); 1544 while (this_term != end_term) { 1545 freqmsg += (*this_term).term + ": " + (*this_term).freq; 1546 if ((this_term + 1) != end_term) 1547 freqmsg += ", "; 1548 ++this_term; 1549 } 1550 1548 1551 disp.setmacro ("freqmsg", "query", freqmsg); 1549 1552 } -
trunk/gsdl/src/recpt/queryaction.h
r7385 r9698 70 70 virtual void define_single_query_macros (cgiargsclass &args, 71 71 displayclass &disp, 72 const FilterResponse_t &response, 73 bool syntax_error); 72 const FilterResponse_t &response); 74 73 virtual void define_query_macros (cgiargsclass &args, displayclass &disp, 75 74 int numDocs, isapprox isApprox);
Note:
See TracChangeset
for help on using the changeset viewer.