Changeset 12421


Ignore:
Timestamp:
2006-08-09T13:06:51+12:00 (18 years ago)
Author:
mdewsnip
Message:

Now catches TooManyClauses exceptions from Lucene and tells the user that this has happened.

Location:
trunk/gsdl
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/macros/english.dm

    r12380 r12421  
    317317_textinvalidquery_ {Invalid query syntax}
    318318_textstopwordsmsg_ {The following words are too common and were ignored: }
     319_textlucenetoomanyclauses_ {Your query contained too many search terms; please try a more specific query.}
    319320
    320321_textmorethan_ {More than }
  • trunk/gsdl/src/colservr/expat_resultset.cpp

    r12420 r12421  
    4545  if (element_name == "Error") {
    4646    char* error_type_str = get_attribute(attributes, "type");
     47    queryresult_ptr->error_message = error_type_str;
    4748    if ((text_t) error_type_str == "PARSE_EXCEPTION") {
    4849      queryresult_ptr->syntax_error = true;
  • trunk/gsdl/src/colservr/lucenequeryfilter.cpp

    r12380 r12421  
    164164  queryresultsclass queryresults;
    165165  do_multi_query (request, queryfilterparams, queryresults, err, logout);
     166  response.error_message = queryresults.error_message;
    166167  if (err != noError) return;
     168
    167169  // assemble document results
    168170  if (need_matching_docs (request.filterResultOptions)) {
     
    343345           
    344346      if (query_params.size() == 1) {
     347    multiresults.error_message = thisqueryresults.error_message;
    345348    multiresults.docs = thisqueryresults.docs; // just one set of results
    346349    multiresults.docs_matched = thisqueryresults.docs_matched;
  • trunk/gsdl/src/colservr/queryinfo.cpp

    r12410 r12421  
    328328
    329329void queryresultsclass::clear () {
     330  error_message = g_EmptyText;
    330331  docs_matched = 0;
    331332  is_approx = Exact;
     
    339340
    340341queryresultsclass &queryresultsclass::operator=(const queryresultsclass &q) {
     342  error_message = q.error_message;
    341343  docs_matched = q.docs_matched;
    342344  is_approx = q.is_approx;
  • trunk/gsdl/src/colservr/queryinfo.h

    r12410 r12421  
    168168  queryresultsclass () {clear();}
    169169
     170  text_t error_message;  // Currently only used by Lucene
    170171  int docs_matched; // not available on all versions of mg
    171172  isapprox is_approx;
  • trunk/gsdl/src/recpt/comtypes.cpp

    r12380 r12421  
    263263
    264264void FilterResponse_t::clear () {
     265  error_message = g_EmptyText;
    265266  numDocs = 0;
    266267  isApprox = Exact;
     
    271272
    272273FilterResponse_t &FilterResponse_t::operator=(const FilterResponse_t &x) {
     274  error_message = x.error_message;
    273275  numDocs = x.numDocs;
    274276  isApprox = x.isApprox;
  • trunk/gsdl/src/recpt/comtypes.h

    r12380 r12421  
    328328  FilterResponse_t () {clear();}
    329329
     330  text_t error_message;  // Currently only used by Lucene
    330331  int numDocs;
    331332  isapprox isApprox;
  • trunk/gsdl/src/recpt/queryaction.cpp

    r12389 r12421  
    12191219      break;
    12201220    }
     1221    if (response.error_message == "TOO_MANY_CLAUSES") {
     1222      freqmsg = "_textlucenetoomanyclauses_";
     1223      break;
     1224    }
    12211225    if (isApprox == Exact)
    12221226      isApprox = response.isApprox;
     
    13701374  get_formatted_query_string(formattedstring, segment, args, disp, logout);
    13711375
    1372     if (!formattedstring.empty()) { // do the query
     1376  if (!formattedstring.empty()) { // do the query
    13731377    // note! formattedstring is in unicode! mg and mgpp must convert!
    13741378    set_queryfilter_options (request, formattedstring, args);
     
    14261430      save_search_history(args, response.numDocs, response.isApprox);
    14271431    }
     1432
     1433    // If Lucene threw a TooManyClauses exception, tell the user about it
     1434    if (args["ct"] == 2 && response.error_message == "TOO_MANY_CLAUSES") {
     1435      disp.setmacro ("freqmsg", "query", "_textlucenetoomanyclauses_");
     1436    }
    14281437  }
    14291438  define_history_macros (disp, args, protos, logout);
    1430  
     1439
    14311440  textout << outconvert << disp << "_query:header_\n"
    14321441      << "_query:content_";
Note: See TracChangeset for help on using the changeset viewer.