Changeset 334 for trunk/gsdl/src/colservr
- Timestamp:
- 1999-07-01T21:29:21+12:00 (25 years ago)
- Location:
- trunk/gsdl/src/colservr
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/mgq.c
r324 r334 12 12 /* 13 13 $Log$ 14 Revision 1.7 1999/07/01 09:29:18 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 14 18 Revision 1.6 1999/07/01 03:52:05 rjmcnab 15 19 Added a function to get the equivalent terms of a query term. I also … … 608 612 } 609 613 614 /* gets the total number of documents retrieved. If this is not available */ 615 /* it will set total_retrieved to 0 (even when it obviously isn't) */ 616 int mgq_docsretrieved (int *total_retrieved, int *is_approx) { 617 query_data *qd = NULL; 618 619 if (cur_cachenum == -1) return 0; 620 qd = dbcache[cur_cachenum].qd; 621 if (qd == NULL || total_retrieved == NULL || is_approx == NULL) return 0; 622 623 /* set default values */ 624 *total_retrieved = 0; 625 *is_approx = 0; 626 627 if (qd->DL == NULL) return 0; 628 629 *total_retrieved = qd->DL->total_retrieved; 630 *is_approx = qd->DL->is_approx; 631 632 return 0; 633 } 634 635 610 636 /* use mgq_getmaxstemlen to determine the length of the word stems to pass */ 611 637 /* to mgq_stemword */ -
trunk/gsdl/src/colservr/mgq.h
r324 r334 36 36 int mgq_equivterms (unsigned char *wordstem, int (*sender)(char *, int, int, float, void *), 37 37 void *ptr); 38 39 /* gets the total number of documents retrieved. If this is not available */ 40 /* it will set total_retrieved to 0 (even when it obviously isn't) */ 41 int mgq_docsretrieved (int *total_retrieved, int *is_approx); 38 42 39 43 /* use mgq_getmaxstemlen to determine the length of the word stems to pass */ -
trunk/gsdl/src/colservr/mgsearch.cpp
r325 r334 12 12 /* 13 13 $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 14 18 Revision 1.9 1999/07/01 03:54:48 rjmcnab 15 19 Added code to plug in the equivalent terms of each of the query terms. … … 378 382 setsearchmode (queryparams); 379 383 submitquery (queryparams); 380 getresults (query results);384 getresults (queryparams, queryresults); 381 385 return true; 382 386 } … … 445 449 446 450 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 } 451 void 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 } 461 462 462 463 // get the term frequencies … … 468 469 mgq_results(result_terms, 0, MAXNUMTERMS, 469 470 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 } 470 487 } 471 488 -
trunk/gsdl/src/colservr/mgsearch.h
r325 r334 73 73 void setsearchmode (const queryparamclass &queryparams); 74 74 void submitquery (const queryparamclass &queryparams); 75 void getresults ( queryresultsclass &queryresults);75 void getresults (const queryparamclass &queryparams, queryresultsclass &queryresults); 76 76 77 77 virtual void extractquoted (text_t &ttquerystring, text_t &ttquotedquery); -
trunk/gsdl/src/colservr/queryfilter.cpp
r327 r334 12 12 /* 13 13 $Log$ 14 Revision 1.9 1999/07/01 09:29:20 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 14 18 Revision 1.8 1999/07/01 03:59:54 rjmcnab 15 19 reduced MAXDOCS to 200 (more reasonable ???). I also added a virtual … … 389 393 } 390 394 391 response.numDocs = queryresults. getnumdocs();392 response.isApprox = (queryresults.getnumdocs() == queryparams.maxdocs);393 } 395 response.numDocs = queryresults.docs_matched; 396 response.isApprox = queryresults.is_approx; 397 } -
trunk/gsdl/src/colservr/queryinfo.cpp
r326 r334 12 12 /* 13 13 $Log$ 14 Revision 1.6 1999/07/01 09:29:21 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 14 18 Revision 1.5 1999/07/01 03:56:17 rjmcnab 15 19 Added a set of utf8 encoded equivalent terms of a query term. I also … … 158 162 159 163 void queryresultsclass::clear () { 160 docs_matched_set = false;;161 164 docs_matched = 0; 162 165 is_approx = false; … … 170 173 171 174 queryresultsclass &queryresultsclass::operator=(const queryresultsclass &q) { 172 docs_matched_set = q.docs_matched_set;173 175 docs_matched = q.docs_matched; 174 176 is_approx = q.is_approx; -
trunk/gsdl/src/colservr/queryinfo.h
r326 r334 107 107 queryresultsclass () {clear();} 108 108 109 bool docs_matched_set;110 109 int docs_matched; // not available on all versions of mg 111 110 bool is_approx; // not available on all versions of mg … … 121 120 queryresultsclass &operator=(const queryresultsclass &q); 122 121 123 int getnumdocs () {124 if (docs_matched_set) return docs_matched;125 else return docs.size();126 }127 int getnumterms () {return terms.size();}128 129 122 void sortuniqqueryterms(); 130 123 };
Note:
See TracChangeset
for help on using the changeset viewer.