[174] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * queryaction.h --
|
---|
| 4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
| 5 | *
|
---|
[533] | 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.
|
---|
[174] | 9 | *
|
---|
[533] | 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 | *
|
---|
[174] | 24 | *********************************************************************/
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | #ifndef QUERYACTION_H
|
---|
| 28 | #define QUERYACTION_H
|
---|
| 29 |
|
---|
| 30 | #include "gsdlconf.h"
|
---|
| 31 | #include "action.h"
|
---|
[1270] | 32 | #include "receptionist.h"
|
---|
[174] | 33 |
|
---|
[757] | 34 | struct colinfo_t {
|
---|
| 35 | void clear();
|
---|
| 36 | colinfo_t () {clear();}
|
---|
[174] | 37 |
|
---|
[757] | 38 | format_t *formatlistptr;
|
---|
| 39 | browserclass *browserptr;
|
---|
| 40 | };
|
---|
| 41 |
|
---|
| 42 | struct QueryResult_t {
|
---|
| 43 | void clear ();
|
---|
| 44 | QueryResult_t () {clear();}
|
---|
| 45 |
|
---|
| 46 | ResultDocInfo_t doc;
|
---|
| 47 | text_t collection;
|
---|
| 48 | };
|
---|
| 49 |
|
---|
| 50 | struct 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 |
|
---|
| 56 | typedef set<QueryResult_t, gteqQueryResult_t> QueryResult_tset;
|
---|
| 57 |
|
---|
| 58 |
|
---|
[174] | 59 | class queryaction : public action {
|
---|
[275] | 60 |
|
---|
| 61 | protected:
|
---|
[1270] | 62 |
|
---|
| 63 | receptionist *recpt;
|
---|
| 64 |
|
---|
[337] | 65 | text_t formatstring;
|
---|
[403] | 66 | int num_phrases;
|
---|
[337] | 67 |
|
---|
[4200] | 68 | virtual void define_single_query_macros (cgiargsclass &args,
|
---|
| 69 | displayclass &disp,
|
---|
[4220] | 70 | const FilterResponse_t &response,
|
---|
| 71 | bool syntax_error);
|
---|
[928] | 72 | virtual void define_query_macros (cgiargsclass &args, displayclass &disp,
|
---|
[4200] | 73 | int numDocs, isapprox isApprox);
|
---|
[397] | 74 |
|
---|
[4200] | 75 | void get_formatted_query_string (text_t &formattedstring, cgiargsclass &args,
|
---|
| 76 | displayclass &disp, ostream &logout);
|
---|
[2769] | 77 | void define_query_interface(displayclass &disp, cgiargsclass &args,
|
---|
[4200] | 78 | recptprotolistclass *protos, ostream &logout);
|
---|
| 79 |
|
---|
[1915] | 80 | void define_form_macros (displayclass &disp, cgiargsclass &args,
|
---|
| 81 | recptprotolistclass *protos, ostream &logout);
|
---|
| 82 |
|
---|
[928] | 83 | void define_history_macros (displayclass &disp, cgiargsclass &args,
|
---|
| 84 | recptprotolistclass *protos, ostream &logout);
|
---|
| 85 |
|
---|
| 86 | virtual void set_option_macro (const text_t ¯oname, text_t current_value,
|
---|
[4937] | 87 | bool display_single, bool add_js_update,
|
---|
[275] | 88 | const FilterOption_t &option, displayclass &disp);
|
---|
| 89 |
|
---|
[4780] | 90 | void set_gformselection_macro (text_t current_value,
|
---|
| 91 | const FilterOption_t &option,
|
---|
| 92 | displayclass &disp);
|
---|
| 93 |
|
---|
[928] | 94 | void output_ccp (cgiargsclass &args, recptprotolistclass *protos,
|
---|
| 95 | displayclass &disp, outconvertclass &outconvert,
|
---|
| 96 | ostream &textout, ostream &logout);
|
---|
| 97 |
|
---|
[1915] | 98 | bool search_multiple_collections (cgiargsclass &args,
|
---|
| 99 | recptprotolistclass *protos,
|
---|
| 100 | browsermapclass *browsers,
|
---|
| 101 | displayclass &disp,
|
---|
| 102 | outconvertclass &outconvert,
|
---|
| 103 | ostream &textout,
|
---|
[757] | 104 | ostream &logout);
|
---|
[1915] | 105 |
|
---|
[3364] | 106 | virtual bool search_single_collection (cgiargsclass &args,
|
---|
| 107 | const text_t &collection,
|
---|
| 108 | recptprotolistclass *protos,
|
---|
| 109 | browsermapclass *browsers,
|
---|
| 110 | displayclass &disp,
|
---|
| 111 | outconvertclass &outconvert,
|
---|
| 112 | ostream &textout, ostream &logout);
|
---|
[757] | 113 |
|
---|
| 114 |
|
---|
[4200] | 115 | bool save_search_history(cgiargsclass &args, int numdocs, isapprox isApprox);
|
---|
[928] | 116 |
|
---|
[174] | 117 | public:
|
---|
| 118 | queryaction ();
|
---|
| 119 | virtual ~queryaction () {}
|
---|
[1270] | 120 |
|
---|
| 121 | void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
|
---|
[174] | 122 |
|
---|
| 123 | void configure (const text_t &key, const text_tarray &cfgline);
|
---|
| 124 | bool init (ostream &logout);
|
---|
| 125 |
|
---|
[928] | 126 | virtual text_t get_action_name () {return "q";}
|
---|
[174] | 127 |
|
---|
[928] | 128 | virtual bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
|
---|
[3546] | 129 | recptprotolistclass *protos, ostream &logout);
|
---|
[757] | 130 |
|
---|
| 131 | void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
|
---|
| 132 | response_t &response, text_t &response_data,
|
---|
| 133 | ostream &logout);
|
---|
[174] | 134 |
|
---|
[928] | 135 | virtual void define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
[757] | 136 | recptprotolistclass *protos, ostream &logout);
|
---|
| 137 |
|
---|
[928] | 138 | virtual void define_external_macros (displayclass &disp, cgiargsclass &args,
|
---|
[757] | 139 | recptprotolistclass *protos, ostream &logout);
|
---|
[174] | 140 |
|
---|
[928] | 141 | virtual bool do_action (cgiargsclass &args, recptprotolistclass *protos,
|
---|
[757] | 142 | browsermapclass *browsers, displayclass &disp,
|
---|
[421] | 143 | outconvertclass &outconvert, ostream &textout,
|
---|
| 144 | ostream &logout);
|
---|
[3546] | 145 |
|
---|
[174] | 146 | };
|
---|
| 147 |
|
---|
| 148 | #endif
|
---|