source: trunk/gsdl/src/recpt/queryaction.h@ 1270

Last change on this file since 1270 was 1270, checked in by sjboddie, 24 years ago

Receptionist now caches collection information to avoid making multiple
get_collectinfo calls to collection server

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/**********************************************************************
2 *
3 * queryaction.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: queryaction.h 1270 2000-07-05 21:49:36Z sjboddie $
25 *
26 *********************************************************************/
27
28
29#ifndef QUERYACTION_H
30#define QUERYACTION_H
31
32#include "gsdlconf.h"
33#include "action.h"
34#include "receptionist.h"
35
36struct colinfo_t {
37 void clear();
38 colinfo_t () {clear();}
39
40 format_t *formatlistptr;
41 browserclass *browserptr;
42};
43
44struct QueryResult_t {
45 void clear ();
46 QueryResult_t () {clear();}
47
48 ResultDocInfo_t doc;
49 text_t collection;
50};
51
52struct gteqQueryResult_t
53{
54 bool operator()(const QueryResult_t &t1, const QueryResult_t &t2) const
55 { return t1.doc.ranking >= t2.doc.ranking; }
56};
57
58typedef set<QueryResult_t, gteqQueryResult_t> QueryResult_tset;
59
60
61class queryaction : public action {
62
63protected:
64
65 receptionist *recpt;
66
67 text_t formatstring;
68 int num_phrases;
69
70 virtual void define_query_macros (cgiargsclass &args, displayclass &disp,
71 const FilterResponse_t &response);
72
73 void define_history_macros (displayclass &disp, cgiargsclass &args,
74 recptprotolistclass *protos, ostream &logout);
75
76 virtual void set_option_macro (const text_t &macroname, text_t current_value,
77 const FilterOption_t &option, displayclass &disp);
78
79 void output_ccp (cgiargsclass &args, recptprotolistclass *protos,
80 displayclass &disp, outconvertclass &outconvert,
81 ostream &textout, ostream &logout);
82
83
84
85 bool search_multiple_collections (cgiargsclass &args, recptprotolistclass *protos,
86 browsermapclass *browsers, displayclass &disp,
87 outconvertclass &outconvert, ostream &textout,
88 ostream &logout);
89
90
91 bool search_single_collection (cgiargsclass &args, const text_t &collection,
92 recptprotolistclass *protos, browsermapclass *browsers,
93 displayclass &disp, outconvertclass &outconvert,
94 ostream &textout, ostream &logout);
95
96
97 bool save_search_history(cgiargsclass &args, const FilterResponse_t &response);
98 bool delete_search_history(cgiargsclass &args);
99
100public:
101 queryaction ();
102 virtual ~queryaction () {}
103
104 void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
105
106 void configure (const text_t &key, const text_tarray &cfgline);
107 bool init (ostream &logout);
108
109 virtual text_t get_action_name () {return "q";}
110
111 virtual bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
112 ostream &logout);
113
114 void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
115 response_t &response, text_t &response_data,
116 ostream &logout);
117
118 virtual void define_internal_macros (displayclass &disp, cgiargsclass &args,
119 recptprotolistclass *protos, ostream &logout);
120
121 virtual void define_external_macros (displayclass &disp, cgiargsclass &args,
122 recptprotolistclass *protos, ostream &logout);
123
124 virtual bool do_action (cgiargsclass &args, recptprotolistclass *protos,
125 browsermapclass *browsers, displayclass &disp,
126 outconvertclass &outconvert, ostream &textout,
127 ostream &logout);
128};
129
130#endif
131
132
Note: See TracBrowser for help on using the repository browser.