source: gsdl/trunk/src/colservr/mgqueryfilter.h@ 15757

Last change on this file since 15757 was 15595, checked in by mdewsnip, 16 years ago

(Adding new DB support) Removed a bunch of "gdbm"s from comments etc.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/**********************************************************************
2 *
3 * mgqueryfilter.h -- queryfilter for old mg
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id: mgqueryfilter.h 15595 2008-05-20 01:46:00Z mdewsnip $
25 *
26 *********************************************************************/
27
28#ifndef MGQUERYFILTER_H
29#define MGQUERYFILTER_H
30
31#include "queryfilter.h"
32
33
34// resultsorderer_t is used to sort the query results
35struct resultsorderer_t {
36 bool compare_phrase_match;
37 bool compare_terms_match;
38 bool compare_doc_weight;
39 docresultmap *docset;
40
41 resultsorderer_t();
42 void clear();
43 bool operator()(const int &t1, const int &t2) const;
44};
45
46
47
48class mgqueryfilterclass : public queryfilterclass {
49protected:
50
51 int num_phrases;
52
53 void get_phrase_terms (const text_t &querystring,
54 const termfreqclassarray &orgterms,
55 vector<termfreqclassarray> &phrases);
56
57 // do aditional query processing
58 virtual void post_process (const queryparamclass &queryparams,
59 queryresultsclass &queryresults);
60
61 // do query that might involve multiple sub queries
62 // mgsearchptr and db_ptr are assumed to be valid
63 void do_multi_query (const FilterRequest_t &request,
64 const vector<queryparamclass> &query_params,
65 queryresultsclass &multiresults,
66 comerror_t &err, ostream &logout);
67
68 virtual void sort_doc_results (const FilterRequest_t &request,
69 docresultsclass &docs);
70
71 virtual void mg_parse_query_params (const FilterRequest_t &request,
72 vector<queryparamclass> &query_params,
73 int &startresults, int &endresults,
74 text_t &phrasematch, ostream &logout);
75
76
77public:
78 mgqueryfilterclass ();
79 virtual ~mgqueryfilterclass ();
80
81 virtual void configure (const text_t &key, const text_tarray &cfgline);
82
83 void filter (const FilterRequest_t &request,
84 FilterResponse_t &response,
85 comerror_t &err, ostream &logout);
86};
87
88
89#endif
Note: See TracBrowser for help on using the repository browser.