source: main/tags/2.10/gsdl/src/colservr/queryfilter.h@ 32704

Last change on this file since 32704 was 534, checked in by sjboddie, 25 years ago

added gpl notice

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/**********************************************************************
2 *
3 * queryfilter.h --
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: queryfilter.h 534 1999-09-07 04:57:43Z sjboddie $
25 *
26 *********************************************************************/
27
28
29#ifndef QUERYFILTER_H
30#define QUERYFILTER_H
31
32
33#include "gsdlconf.h"
34#include "text_t.h"
35#include "comtypes.h"
36#include "filter.h"
37#include "infodbclass.h"
38#include "maptools.h"
39#include "mgsearch.h"
40#include "queryinfo.h"
41
42
43// resultsorderer_t is used to sort the query results
44struct resultsorderer_t {
45 bool compare_phrase_match;
46 bool compare_terms_match;
47 bool compare_doc_weight;
48 docresultmap *docset;
49
50 resultsorderer_t();
51 void clear();
52 bool operator()(const int &t1, const int &t2) const;
53};
54
55
56
57class queryfilterclass : public filterclass {
58protected:
59
60 stringmap indexmap;
61 stringmap subcollectionmap;
62 stringmap languagemap;
63
64 text_t gdbm_filename;
65 gdbmclass *gdbmptr;
66
67 mgsearchclass *mgsearchptr;
68
69
70 void get_phrase_terms (const text_t &querystring,
71 const termfreqclassarray &orgterms,
72 vector<termfreqclassarray> &phrases);
73
74 // do aditional query processing
75 virtual void post_process (const queryparamclass &queryparams,
76 queryresultsclass &queryresults);
77
78 // get the query parameters
79 void parse_query_params (const FilterRequest_t &request,
80 vector<queryparamclass> &query_params,
81 int &startresults,
82 int &endresults,
83 ostream &logout);
84
85 // do query that might involve multiple sub queries
86 // mgsearchptr and gdbmptr are assumed to be valid
87 void do_multi_query (const FilterRequest_t &request,
88 const vector<queryparamclass> &query_params,
89 queryresultsclass &multiresults,
90 comerror_t &err, ostream &logout);
91
92 virtual void sort_doc_results (const FilterRequest_t &request,
93 docresultsclass &docs);
94
95
96public:
97 queryfilterclass ();
98 virtual ~queryfilterclass ();
99
100 // the gdbmptr remains the responsability of the calling code
101 void set_gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}
102
103 // the mgsearchptr remains the responsability of the calling code
104 void set_mgsearchptr (mgsearchclass *themgsearchptr) {mgsearchptr=themgsearchptr;}
105
106 void configure (const text_t &key, const text_tarray &cfgline);
107 bool init (ostream &logout);
108 text_t get_filter_name () {return "QueryFilter";}
109 void filter (const FilterRequest_t &request,
110 FilterResponse_t &response,
111 comerror_t &err, ostream &logout);
112};
113
114
115#endif
Note: See TracBrowser for help on using the repository browser.