Ignore:
Timestamp:
1999-07-01T21:29:21+12:00 (25 years ago)
Author:
rjmcnab
Message:

Changes for better reporting of number documents which match a query. Changes
should still work as before with older versions of mg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/mgsearch.cpp

    r325 r334  
    1212/*
    1313   $Log$
     14   Revision 1.10  1999/07/01 09:29:19  rjmcnab
     15   Changes for better reporting of number documents which match a query. Changes
     16   should still work as before with older versions of mg.
     17
    1418   Revision 1.9  1999/07/01 03:54:48  rjmcnab
    1519   Added code to plug in the equivalent terms of each of the query terms.
     
    378382    setsearchmode (queryparams);
    379383    submitquery (queryparams);
    380     getresults (queryresults);
     384    getresults (queryparams, queryresults);
    381385    return true;
    382386  }
     
    445449
    446450
    447 void mgsearchclass::getresults (queryresultsclass &queryresults)
    448 {
    449   if (quotedquery[0] == '\0')
    450     {
    451       // don't need the text
    452       mgq_results(result_docnums, 0, MAXNUMDOCS,
    453           ourquerycallback, (void *)(&queryresults));
    454     }
    455   else
    456     {
    457       // we need the text for this one
    458       mgq_results(result_docs, 0, MAXNUMDOCS,
    459           ourquerycallback, (void *)(&queryresults));
    460     }
     451void mgsearchclass::getresults (const queryparamclass &queryparams,
     452                queryresultsclass &queryresults) {
     453  if (quotedquery[0] == '\0') {
     454    // don't need the text
     455    mgq_results(result_docnums, 0, MAXNUMDOCS,
     456        ourquerycallback, (void *)(&queryresults));
     457  } else {
     458    // we need the text for this one
     459    mgq_results(result_docs, 0, MAXNUMDOCS,
     460        ourquerycallback, (void *)(&queryresults));
     461  }
    461462 
    462463  // get the term frequencies
     
    468469  mgq_results(result_terms, 0, MAXNUMTERMS,
    469470              termvariantscallback, (void *)(&queryresults));
     471
     472  // get the number of documents retrieved
     473  int total_retrieved = 0, is_approx = 0;
     474  mgq_docsretrieved (&total_retrieved, &is_approx);
     475
     476  if (total_retrieved == 0) {
     477    // not available (or really was zero)
     478    queryresults.docs_matched = queryresults.docs.size();
     479    if (queryresults.docs_matched < queryparams.maxdocs)
     480      queryresults.is_approx = true;
     481    else
     482      queryresults.is_approx = false;
     483  } else {
     484    queryresults.docs_matched = total_retrieved;
     485    queryresults.is_approx = is_approx;
     486  }
    470487}
    471488
Note: See TracChangeset for help on using the changeset viewer.