Changeset 800 for trunk


Ignore:
Timestamp:
1999-12-06T10:22:33+13:00 (24 years ago)
Author:
sjboddie
Message:

tidied up cross-collection searching a bit

File:
1 edited

Legend:

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

    r776 r800  
    2828/*
    2929   $Log$
     30   Revision 1.31  1999/12/05 21:22:33  sjboddie
     31   tidied up cross-collection searching a bit
     32
    3033   Revision 1.30  1999/11/08 20:26:37  sjboddie
    3134   added multiplevalue option to cgiarginfo
     
    438441  text_tarray phrases;
    439442  get_phrases (args["q"], phrases);
     443  num_phrases = phrases.size();
    440444  text_tarray::const_iterator phere = phrases.begin();
    441445  text_tarray::const_iterator pend = phrases.end();
     
    661665    // from extlinkaction for now - this will probably want to use
    662666    // a separate argument eventually)
    663     if (args["ccp"] != 1 && args["el"] != "direct") {
     667    //    if (args["ccp"] != 1 && args["el"] != "direct") {
    664668      // display the cross collection search page
    665       output_ccp (args, protos, disp, outconvert, textout, logout);
    666     } else {
     669    //      output_ccp (args, protos, disp, outconvert, textout, logout);
     670    //    } else {
    667671      // query the selected collections
     672
     673    text_t::const_iterator b = args["cc"].begin();
     674    text_t::const_iterator e = args["cc"].end();
     675    if (!args["cc"].empty() && (findchar (b, e, ',') != e))
    668676      if (!search_multiple_collections (args, protos, browsers, disp, outconvert,
    669677                    textout, logout)) return false;
    670     }
    671   } else {
    672     // simply query the current collection
    673     if (!search_single_collection (args, protos, browsers, disp, outconvert,
    674                    textout, logout)) return false;
    675   }
    676 
     678      else return true;
     679  }
     680
     681  // simply query the current collection
     682  if (!search_single_collection (args, protos, browsers, disp, outconvert,
     683                 textout, logout)) return false;
     684 
    677685  return true;
    678686}
     
    713721  text_t freqmsg = "_textfreqmsg1_";
    714722  int numdocs = 0;
     723  isapprox isApprox = Exact;
    715724  text_tset colnamedata;
    716725  colnamedata.insert ("collectionname");
     
    775784    }
    776785
     786    if (isApprox == Exact)
     787      isApprox = response.isApprox;
     788    else if (isApprox == MoreThan)
     789      if (response.isApprox == Approximate)
     790    isApprox = response.isApprox;
     791
    777792    text_t collectionname = *col_here;
    778793    FilterResponse_t nresponse;
     
    808823  }
    809824
    810   if (numdocs > 0) disp.setmacro ("freqmsg", "query", freqmsg);
    811   else disp.setmacro("resultline", "query", "_textnodocs_");
    812 
     825  disp.setmacro ("freqmsg", "query", freqmsg);
     826
     827  text_t resline;
     828  if (num_phrases > 0) isApprox = Exact;
     829  if (isApprox == Approximate) resline = "_textapprox_";
     830  else if (isApprox == MoreThan) resline = "_textmorethan_";
     831 
     832  if (numdocs == 0) resline = "_textnodocs_";
     833  else if (numdocs == 1) resline += "_text1doc_";
     834  else resline += text_t(numdocs) + " _textlotsdocs_";
     835  disp.setmacro("resultline", "query", resline);
    813836
    814837  QueryResult_tset::iterator res_here = results.begin();
     
    9821005  // if there were phrases (post-processing) we're not going to include
    9831006  // those documents that didn't match
    984   if (num_phrases > 0) {
    985     numdocs = 0;
    986     isApprox = Exact;
    987     ResultDocInfo_tarray::const_iterator this_doc = response.docInfo.begin();
    988     ResultDocInfo_tarray::const_iterator end_doc = response.docInfo.end();
    989     while (this_doc != end_doc) {
    990       if ((*this_doc).num_phrase_match == num_phrases) numdocs ++;
    991       else break; // we can bail here as matching docs are sorted to top
    992       this_doc++;
    993     }
    994   }
     1007  if (num_phrases > 0) isApprox = Exact;
    9951008
    9961009  if (isApprox == Approximate) resline = "_textapprox_";
Note: See TracChangeset for help on using the changeset viewer.