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

Last change on this file since 7067 was 6584, checked in by kjdon, 20 years ago

Fiddled around with segmenting for chinese text. Haven't changed how the
segmentation is done, or what character ranges are used.
But when its done is now controlled by the collect.cfg. There is a new
option, separate_cjk, values true or false, default false. Segmentation
is only done if this is set to true. This is passed as a global option to
all plugins by the import.pl script, so the user just needs to add it
once to the config file, not as an option to all plugins.
The queryaction uses this option too to determine whether or not to segment
the query.

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