source: trunk/gsdl/src/colservr/queryfilter.h@ 12246

Last change on this file since 12246 was 10954, checked in by kjdon, 18 years ago

made the indexfieldmap use defaultindex for mgppqueryfilter so that can set the default field for plain search

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