source: trunk/gsdl/src/colservr/phrasequeryfilter.cpp@ 367

Last change on this file since 367 was 351, checked in by rjmcnab, 25 years ago

Added ability to combine two or more independant queries.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/**********************************************************************
2 *
3 * phrasequeryfilter.cpp --
4 * Copyright (C) 1999 DigiLib Systems Limited, New Zealand
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: phrasequeryfilter.cpp 351 1999-07-07 06:19:47Z rjmcnab $
9 *
10 *********************************************************************/
11
12/*
13 $Log$
14 Revision 1.2 1999/07/07 06:19:45 rjmcnab
15 Added ability to combine two or more independant queries.
16
17 Revision 1.1 1999/07/01 04:01:47 rjmcnab
18 Initial revision.
19
20
21 */
22
23
24#include "phrasequeryfilter.h"
25#include "queryinfo.h"
26
27#include "phrasesearch.h"
28
29
30
31// do aditional query processing
32void phrasequeryfilterclass::post_process (const queryparamclass &queryparams,
33 queryresultsclass &queryresults) {
34 // post-process the results if needed
35 if (queryresults.orgterms.size() > 1 && !queryresults.docs.docset.empty()) {
36 // get the long version of the index
37 text_t longindex;
38 indexmap.to2from (queryparams.index, longindex);
39
40 // process each of the matched documents
41 docresultmap::iterator docs_here = queryresults.docs.docset.begin();
42 docresultmap::iterator docs_end = queryresults.docs.docset.end();
43 while (docs_here != docs_end) {
44 if ((*docs_here).second.num_query_terms_matched == queryresults.orgterms.size() &&
45 OID_phrase_search (*mgsearchptr, *gdbmptr, queryparams.index,
46 queryparams.subcollection, queryparams.language,
47 longindex, queryparams.collection, queryresults.orgterms,
48 (*docs_here).second.docnum)) {
49 (*docs_here).second.num_phrase_match++;
50 }
51
52 docs_here++;
53 }
54 }
55}
56
57
58void phrasequeryfilterclass::sort_doc_results (const FilterRequest_t &/*request*/,
59 docresultsclass &docs) {
60 resultsorderer_t resultsorderer;
61 resultsorderer.compare_phrase_match = true;
62 resultsorderer.compare_terms_match = true;
63 resultsorderer.compare_doc_weight = true;
64 resultsorderer.docset = &(docs.docset);
65
66 // first get a list of document numbers
67 docs.docnum_order();
68
69 sort (docs.docorder.begin(), docs.docorder.end(), resultsorderer);
70}
Note: See TracBrowser for help on using the repository browser.