source: main/trunk/greenstone2/runtime-src/src/colservr/queryfilter.h@ 27065

Last change on this file since 27065 was 27064, checked in by kjdon, 11 years ago

adding reverse sort/sort order in for lucene search results sorting. reorganising code to avoid duplication, added fieldedqueryfilter in the chain of inheritance

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