Changeset 766 for trunk/gsdl
- Timestamp:
- 1999-11-02T11:06:06+13:00 (25 years ago)
- Location:
- trunk/gsdl/src/colservr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/queryfilter.cpp
r722 r766 28 28 /* 29 29 $Log$ 30 Revision 1.20 1999/11/01 22:06:06 sjboddie 31 Added filter option to remove documents not matching a phrase match. 32 This used to be done in the receptionist. 33 30 34 Revision 1.19 1999/10/19 03:23:40 davidb 31 35 Collection building support through web pages … … 243 247 get_phrase_terms (queryparams.querystring, queryresults.orgterms, phrases); 244 248 245 if (phrases.size() > 0) { 249 num_phrases = phrases.size(); 250 if (num_phrases > 0) { 246 251 247 252 // get the long version of the index … … 276 281 void queryfilterclass::parse_query_params (const FilterRequest_t &request, 277 282 vector<queryparamclass> &query_params, 278 int &startresults, 279 int &endresults, 280 ostream &logout) { 283 int &startresults, int &endresults, 284 text_t &phrasematch, ostream &logout) { 281 285 outconvertclass text_t2ascii; 282 286 … … 285 289 startresults = filterOptions["StartResults"].defaultValue.getint(); 286 290 endresults = filterOptions["EndResults"].defaultValue.getint(); 291 phrasematch = filterOptions["PhraseMatch"].defaultValue; 287 292 288 293 // set defaults for query parameters … … 352 357 } else if ((*options_here).name == "Maxdocs") { 353 358 query.maxdocs = (*options_here).value.getint(); 359 } else if ((*options_here).name == "PhraseMatch") { 360 phrasematch = (*options_here).value; 354 361 } else { 355 362 logout << text_t2ascii … … 464 471 gdbmptr = NULL; 465 472 mgsearchptr = NULL; 473 num_phrases = 0; 466 474 467 475 FilterOption_t filtopt; … … 576 584 filtopt.validValues.push_back("1000"); 577 585 filterOptions["Maxdocs"] = filtopt; 586 587 // -- onePerQuery PhraseMatch enumerated 588 filtopt.clear(); 589 filtopt.name = "PhraseMatch"; 590 filtopt.type = FilterOption_t::enumeratedt; 591 filtopt.repeatable = FilterOption_t::onePerQuery; 592 filtopt.defaultValue = "some_phrases"; 593 filtopt.validValues.push_back ("all_phrases"); 594 filtopt.validValues.push_back ("some_phrases"); 595 filtopt.validValues.push_back ("all_docs"); 596 filterOptions["PhraseMatch"] = filtopt; 578 597 } 579 598 … … 678 697 int startresults = filterOptions["StartResults"].defaultValue.getint(); 679 698 int endresults = filterOptions["EndResults"].defaultValue.getint(); 699 text_t phrasematch = filterOptions["PhraseMatch"].defaultValue; 700 680 701 vector<queryparamclass> queryfilterparams; 681 parse_query_params (request, queryfilterparams, startresults, endresults, logout); 702 parse_query_params (request, queryfilterparams, startresults, 703 endresults, phrasematch, logout); 682 704 683 705 // do query … … 710 732 docresultmap::iterator docset_here = queryresults.docs.docset.find (*docorder_here); 711 733 734 // documents containing matching phrases will be sorted to the top so 735 // we can break out once we're past those that match the PhraseMatch 736 // option -- "all_phrases" = return only those documents containing all 737 // phrases in query string 738 // "some_phrases" = return only those documents containing 739 // at least 1 of the phrases in the document 740 // "all_docs" = return all documents regardless 741 if (num_phrases > 0) { 742 if ((phrasematch == "all_phrases") && ((*docset_here).second.num_phrase_match < num_phrases)) 743 break; 744 if ((phrasematch == "some_phrases") && ((*docset_here).second.num_phrase_match < 1)) 745 break; 746 } 747 712 748 // see if there is a result for this number, 713 749 // if it is in the request set (or the request set is empty) -
trunk/gsdl/src/colservr/queryfilter.h
r534 r766 66 66 67 67 mgsearchclass *mgsearchptr; 68 68 69 int num_phrases; 69 70 70 71 void get_phrase_terms (const text_t &querystring, … … 79 80 void parse_query_params (const FilterRequest_t &request, 80 81 vector<queryparamclass> &query_params, 81 int &startresults, 82 int &endresults, 83 ostream &logout); 82 int &startresults, int &endresults, 83 text_t &phrasematch, ostream &logout); 84 84 85 85 // do query that might involve multiple sub queries
Note:
See TracChangeset
for help on using the changeset viewer.