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

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

(Adding new DB support) Changed lots of "gdbm"s to "db"s, in preparation for adding new DB types.

  • 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 "dbclass.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 db_filename;
51 text_t indexstem;
52 dbclass *db_ptr;
53
54 searchclass *textsearchptr;
55
56 int maxnumeric;
57
58 // get the query parameters
59 void parse_query_params (const FilterRequest_t &request,
60 vector<queryparamclass> &query_params,
61 int &startresults, int &endresults,
62 text_t &phrasematch, ostream &logout);
63
64 // do query that might involve multiple sub queries
65 // textsearchptr and db_ptr are assumed to be valid
66 virtual void do_multi_query (const FilterRequest_t &request,
67 const vector<queryparamclass> &query_params,
68 queryresultsclass &multiresults,
69 comerror_t &err, ostream &logout)=0;
70
71public:
72 queryfilterclass ();
73 virtual ~queryfilterclass ();
74
75 // the db_ptr remains the responsibility of the calling code
76 void set_db_ptr (dbclass *db_ptr_arg) { db_ptr = db_ptr_arg; }
77
78 // the testsearchptr remains the responsability of the calling code
79 void set_textsearchptr (searchclass *thetextsearchptr) {textsearchptr=thetextsearchptr;}
80
81 virtual void configure (const text_t &key, const text_tarray &cfgline);
82 virtual bool init (ostream &logout);
83
84 text_t get_filter_name () {return "QueryFilter";}
85 bool translate(dbclass *db_ptr, int docnum, text_t &trans_OID);
86 bool need_matching_docs (int filterResultOptions);
87 bool need_term_info (int filterResultOptions);
88
89
90 virtual void filter (const FilterRequest_t &request,
91 FilterResponse_t &response,
92 comerror_t &err, ostream &logout)=0;
93
94
95
96};
97
98
99#endif
100
Note: See TracBrowser for help on using the repository browser.