Changeset 9698


Ignore:
Timestamp:
2005-04-15T16:51:11+12:00 (19 years ago)
Author:
kjdon
Message:

now it doesn't crap out when a system error happens (in search_single_collection), just tells the user that no documents matched the query. I think the user should be told that a system problem happened, but Ian doens't think so.

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/queryaction.cpp

    r9620 r9698  
    13161316    set_queryfilter_options (request, formattedstring, args);
    13171317    collectproto->filter (collection, request, response, err, logout);
    1318     if (err != noError && err != syntaxError) {
     1318    if (err != noError) {
    13191319      outconvertclass text_t2ascii;
    13201320      logout << text_t2ascii
    13211321         << "queryaction::search_single_collections: call to QueryFilter failed "
    13221322         << "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()) {
    13301327      // Go directly to the first matching document
    13311328      ResultDocInfo_tarray::iterator thissection = response.docInfo.begin();
     
    13591356
    13601357    //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    }
    13661372  }
    13671373  define_history_macros (disp, args, protos, logout);
     
    13691375  textout << outconvert << disp << "_query:header_\n"
    13701376      << "_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  }
    13781385
    13791386  textout << outconvert << disp << "_query:footer_";
     
    14471454// query had been done. Those macros are
    14481455// _resultline_, _nextfirst_, _nextlast_, _prevfirst_, _prevlast_,
    1449 // _thisfirst_, and _thislast_
     1456// _thisfirst_, and _thislast_ and _quotedquery_
    14501457// this has been simplified so it can be used with both search_single_coll
    14511458// and search_multiple_coll
     
    15251532// define_single_query_macros sets the extra macros for search_single_coll
    15261533// that couldn't be set until the query had been done. Those macros are
    1527 // _freqmsg_, _quotedquery_
     1534// _freqmsg_,
    15281535void queryaction::define_single_query_macros (cgiargsclass &args,
    15291536                          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
    15331539
    15341540  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 
    15481551  disp.setmacro ("freqmsg", "query", freqmsg);
    15491552}
  • trunk/gsdl/src/recpt/queryaction.h

    r7385 r9698  
    7070  virtual void define_single_query_macros (cgiargsclass &args,
    7171                       displayclass &disp,
    72                        const FilterResponse_t &response,
    73                        bool syntax_error);
     72                       const FilterResponse_t &response);
    7473  virtual void define_query_macros (cgiargsclass &args, displayclass &disp,
    7574                int numDocs, isapprox isApprox);
Note: See TracChangeset for help on using the changeset viewer.