source: main/tags/2.31/gsdl/src/colservr/queryfilter.h@ 25382

Last change on this file since 25382 was 1324, checked in by kjm18, 24 years ago

mgpp incorporated. the old mgsearchclass and queryfilterclass are changed.
Have a base searchclass, from which mgsearchclass and mgppsearchclass inherit.
Have a base queryfilterclass, from which mgqueryfilterclass and
mgppqueryfilterclass inherit. librarymain in recpt should choose the appropriate
type (mg vs mgpp) for each collection.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/**********************************************************************
2 *
3 * queryfilter.h -- abstract base class for queryfilters
4 * mgqueryfilter and mgppqueryfilter implement this
5 * Copyright (C) 1999 The New Zealand Digital Library Project
6 *
7 * A component of the Greenstone digital library software
8 * from the New Zealand Digital Library Project at the
9 * University of Waikato, New Zealand.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 *********************************************************************/
26
27
28#ifndef QUERYFILTER_H
29#define QUERYFILTER_H
30
31
32#include "gsdlconf.h"
33#include "text_t.h"
34#include "comtypes.h"
35#include "filter.h"
36#include "infodbclass.h"
37#include "maptools.h"
38#include "search.h"
39#include "queryinfo.h"
40
41
42class queryfilterclass : public filterclass {
43protected:
44
45 stringmap indexmap;
46 stringmap subcollectionmap;
47 stringmap languagemap;
48
49 text_t gdbm_filename;
50 gdbmclass *gdbmptr;
51
52 searchclass *mgsearchptr;
53
54 // get the query parameters
55 void parse_query_params (const FilterRequest_t &request,
56 vector<queryparamclass> &query_params,
57 int &startresults, int &endresults,
58 text_t &phrasematch, ostream &logout);
59
60 // do query that might involve multiple sub queries
61 // mgsearchptr and gdbmptr are assumed to be valid
62 virtual void do_multi_query (const FilterRequest_t &request,
63 const vector<queryparamclass> &query_params,
64 queryresultsclass &multiresults,
65 comerror_t &err, ostream &logout)=0;
66
67public:
68 queryfilterclass ();
69 virtual ~queryfilterclass ();
70
71 // the gdbmptr remains the responsability of the calling code
72 void set_gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}
73
74 // the mgsearchptr remains the responsability of the calling code
75 void set_mgsearchptr (searchclass *themgsearchptr) {mgsearchptr=themgsearchptr;}
76
77 virtual void configure (const text_t &key, const text_tarray &cfgline);
78 bool init (ostream &logout);
79
80 text_t get_filter_name () {return "QueryFilter";}
81 bool translate(gdbmclass *gdbmptr, int docnum, text_t &trans_OID);
82 bool need_matching_docs (int filterResultOptions);
83 bool need_term_info (int filterResultOptions);
84
85
86 virtual void filter (const FilterRequest_t &request,
87 FilterResponse_t &response,
88 comerror_t &err, ostream &logout)=0;
89
90
91
92};
93
94
95#endif
96
Note: See TracBrowser for help on using the repository browser.