source: main/tags/2.70u/gsdl/src/recpt/comtypes.h@ 32020

Last change on this file since 32020 was 10789, checked in by kjdon, 19 years ago

added an option 'supercollectionoptions uniform_search_results_formatting' so that search results formatting all comes from the collection you are in rather than the each individual collection

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 11.3 KB
Line 
1/**********************************************************************
2 *
3 * comtypes.h --
4 * Copyright (C) 1999,2004 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 COMTYPES_H
28#define COMTYPES_H
29
30#include "gsdlconf.h"
31#include "text_t.h"
32
33#if defined(GSDL_USE_OBJECTSPACE)
34# include <ospace\std\vector>
35# include <ospace\std\list>
36# include <ospace\std\memory> // for pair
37# include <ospace\std\map>
38#elif defined(GSDL_USE_STL_H)
39# include <vector.h>
40# include <list.h>
41# include <memory.h> // for pair
42# include <map.h>
43#else
44# include <vector>
45# include <list>
46# include <memory> // for pair
47# include <map>
48#endif
49
50
51enum comerror_t {noError, authenticationFailure, protocolError,
52 configurationError, systemProblem, syntaxError};
53text_t get_comerror_string (comerror_t err);
54
55// ShortColInfo ::= SEQUENCE {
56// name GeneralString,
57// host GeneralString,
58// port INTEGER
59// }
60struct ShortColInfo_t {
61 void clear ();
62 ShortColInfo_t () {clear();}
63
64 text_t name;
65 text_t host;
66 int port;
67};
68
69/* macro name -> (params, value) */
70typedef multimap<text_t, pair<text_t, text_t>, less<text_t> > macros_map;
71
72typedef map<text_t, text_tmap, lttext_t> collectionmeta_map; // maps meta name to langmap
73
74#define CCSUniformSearchResultsFormatting 1
75
76struct ColInfoResponse_t {
77 void clear ();
78 ColInfoResponse_t () {clear();}
79 text_t get_collectionmeta(text_t name, text_t lang);
80
81 ShortColInfo_t shortInfo;
82 bool isPublic;
83 bool isBeta;
84 bool isSegmented;
85 unsigned long buildDate;
86 text_tarray ccsCols; // empty if collection does not use cross-collection searching
87 int ccsOptions; // uses #defines from above
88 text_tarray languages;
89 unsigned long numDocs; // 0 if not known
90 unsigned long numSections; // 0 if not known
91 unsigned long numWords; // 0 if not known
92 unsigned long numBytes; // 0 if not known
93 //text_tmap collectionmeta;
94 collectionmeta_map collectionmeta;
95 text_tmap format;
96 macros_map collection_macros; // for collectionmacro config directive (> gsdl 2.53)
97 text_tmap building;
98 text_t httpdomain; // GRB: could these two http items need removing
99 text_t httpprefix;
100 text_t receptionist;
101 text_t buildType; // 'mg' or 'mgpp' or 'lucene'
102 text_t authenticate; // 'document' or 'collection'
103 text_t auth_group; // 'mygroup' 'yourgroup'
104 text_tmap public_documents; // the acl to allow access to listed documents
105 text_tmap private_documents; // the acl to disallow access to listed documents
106 text_tarray searchTypes; // form, plain, empty if collection uses mg, or has no searching facility
107};
108
109
110// -- filter options which might be supported for the QueryFilter
111// --
112// -- onePerQuery StartResults integer
113// -- onePerQuery EndResults integer
114// -- onePerQuery QueryType enumerated (boolean, ranked)
115// -- onePerTerm Term string ???
116// -- onePerTerm Casefold boolean
117// -- onePerTerm Stem boolean
118// -- onePerTerm Index enumerated
119// -- onePerTerm Subcollection enumerated
120// --
121// -- filter options which might be supported for the BrowseFilter
122// --
123// -- onePerQuery StartResults integer
124// -- onePerQuery EndResults integer
125// -- onePerQuery ParentNode string ("" will return the browsing available)
126// --
127// -- The NullFilter always returns the set it was given, it doesn't have
128// -- any options
129
130// InfoFiltersResponse ::= SEQUENCE {
131// filterNames StringSet
132// }
133struct InfoFiltersResponse_t {
134 void clear ();
135
136 text_tset filterNames;
137};
138
139// InfoFilterOptionsRequest ::= SEQUENCE {
140// filterName GeneralString
141// }
142struct InfoFilterOptionsRequest_t {
143 void clear ();
144
145 text_t filterName;
146};
147
148// FilterOption ::= SEQUENCE {
149// name GeneralString,
150// type ENUMERATED {booleant(0), integert(1), enumeratedt(2), stringt(3)},
151// repeatable ENUMERATED {onePerQuery(0), onePerTerm(1), nPerTerm(2)},
152// defaultValue GeneralString,
153// -- the interpretation of the validValues depends on the type
154// -- for boolean: the first value is the false value, the second is true value
155// -- for integer: the first value is the minimum, the second the maximum
156// -- for enumerated: all values a listed
157// -- for string: this value is ignored
158// validValues StringSequence
159// }
160struct FilterOption_t {
161 void clear ();
162 void check_defaultValue ();
163 FilterOption_t () {clear();}
164
165 text_t name;
166
167 enum type_t {booleant=0, integert=1, enumeratedt=2, stringt=3};
168 type_t type;
169
170 enum repeatable_t {onePerQuery=0, onePerTerm=1, nPerTerm=2};
171 repeatable_t repeatable;
172
173 text_t defaultValue;
174 text_tarray validValues;
175};
176
177bool operator==(const FilterOption_t &x, const FilterOption_t &y);
178bool operator<(const FilterOption_t &x, const FilterOption_t &y);
179
180
181typedef map<text_t, FilterOption_t, lttext_t> FilterOption_tmap;
182
183
184// InfoFilterOptionsResponse ::= SEQUENCE {
185// filterOptions SET OF FilterOption
186// }
187struct InfoFilterOptionsResponse_t {
188 void clear ();
189
190 FilterOption_tmap filterOptions;
191};
192
193
194// OptionValue ::= SEQUENCE {
195// name GeneralString,
196// value GeneralString
197// }
198struct OptionValue_t {
199 void clear ();
200
201 text_t name;
202 text_t value;
203};
204
205typedef vector<OptionValue_t> OptionValue_tarray;
206
207
208// -- Terms are presented in the same order that they are requested,
209// -- any information relating to the terms is in reference to the
210// -- index specified for that term.
211//
212// FilterRequest ::= SEQUENCE {
213// filterName [0] GeneralString,
214// filterOptions [1] IMPLICIT SEQUENCE OF OptionValue,
215// docSet [2] IMPLICIT StringSequence, -- the OID "" represents everything
216// filterResultOptions [3] IMPLICIT BIT STRING {termFreq(0), matchTerms(1), OID(2),
217// subCol(3), ranking(4), docFreq(5),
218// metadata(6)}
219//
220// -- the next set of options are for the metadata request,
221// -- they can be left blank if metadata is not wanted
222// requestParams [4] IMPLICIT GeneralString, -- used to negotiate the metadata content
223// refParams [5] IMPLICIT GeneralString, -- used to decide whether to return a
224// -- reference to the data or the actual data
225// fields [6] IMPLICIT StringSet
226// getParents [7] IMPLICIT BOOLEAN -- gets metadata of all parents too
227// }
228#define FRtermFreq 1
229#define FRmatchTerms 2
230#define FROID 4
231#define FRsubCol 8
232#define FRranking 16
233#define FRdocFreq 32
234#define FRmetadata 64
235// used to indicate a full text browse query for mgpp
236#define FRfullTextBrowse 128
237
238struct FilterRequest_t {
239 void clear ();
240 FilterRequest_t () {clear();}
241
242 text_t filterName;
243 text_t filterLang; // non empty if we want info to be retrived in language specific
244 OptionValue_tarray filterOptions;
245 text_tarray docSet; // empty if not used
246 int filterResultOptions; // use the FR* defines above
247
248 text_t requestParams; // empty if not used
249 text_t refParams; // empty if not used
250 text_tset fields; // empty if not used
251 bool getParents; // defaults to false
252};
253
254
255// TermInfo ::= SEQUENCE {
256// term [0] GeneralString,
257// freq [1] IMPLICIT INTEGER, -- 0 if not requested
258// matchTerms [2] IMPLICIT StringSequence -- empty if not requested
259// }
260struct TermInfo_t {
261 void clear ();
262 TermInfo_t () {clear();}
263
264 text_t term;
265 int freq; // 0 if not requested
266 text_tarray matchTerms; // empty if not requested
267};
268
269typedef vector<TermInfo_t> TermInfo_tarray;
270
271
272// MetadataInfo ::= SEQUENCE {
273// params [0] IMPLICIT GeneralString,
274// isRef [1] IMPLICIT BOOLEAN,
275// values [3] IMPLICIT SEQUENCE OF GeneralString,
276// name [4] IMPLICIT GeneralString
277// }
278struct MetadataInfo_t {
279 text_t params;
280 bool isRef;
281 text_tarray values;
282 MetadataInfo_t *parent;
283
284 void clear ();
285 MetadataInfo_t ();
286 MetadataInfo_t (const MetadataInfo_t &x); // copy constructor
287 ~MetadataInfo_t ();
288 MetadataInfo_t &operator=(const MetadataInfo_t &x);
289};
290
291typedef map<text_t, MetadataInfo_t, lttext_t> MetadataInfo_tmap;
292
293// ResultDocInfo ::= SEQUENCE {
294// OID [0] IMPLICIT GeneralString,
295// ranking [1] IMPLICIT INTEGER, -- 0 if not requested, range 0-10000
296// docFreq [2] IMPLICIT SEQUENCE OF INTEGER, -- empty if not requested
297// metadata [3] IMPLICIT SEQUENCE OF MetadataInfo, -- no longer a SEQUENCE (SET maybe??)
298// classifier_metadata_type [4] IMPLICIT GeneralString, -- empty if not requested
299// classifier_metadata_offset [5] IMPLICIT INTEGER, -- 0 if not requested
300// }
301struct ResultDocInfo_t {
302 void clear ();
303 ResultDocInfo_t () {clear();}
304
305 text_t OID;
306 int result_num; // place in results list
307 int ranking; // 0 if not requested (real ranking*10000)
308 int num_terms_matched; // not available on all versions of mg
309 int num_phrase_match; // not available on all versions of mg
310 vector<int> docFreq; // empty if not requested
311 MetadataInfo_tmap metadata; // empty if not requested
312 text_t classifier_metadata_type; // empty if not requested
313 int classifier_metadata_offset; // 0 if not requested
314 ResultDocInfo_t &operator=(const ResultDocInfo_t &x);
315};
316
317typedef vector<ResultDocInfo_t> ResultDocInfo_tarray;
318
319
320// FilterResponse ::= SEQUENCE {
321// numDocs [0] IMPLICIT INTEGER,
322// isApprox [1] ENUMERATED {Exact(0), Approximate(1), MoreThan(2)}, -- whether numDocs is approximate
323// termInfo [2] IMPLICIT SEQUENCE OF TermInfo, -- empty if not required
324// docInfo [3] IMPLICIT SEQUENCE OF ResultDocInfo -- empty if not required
325// }
326
327enum isapprox {Exact=0, Approximate=1, MoreThan=2};
328
329struct FilterResponse_t {
330 void clear ();
331 FilterResponse_t () {clear();}
332
333 int numDocs;
334 isapprox isApprox;
335 TermInfo_tarray termInfo; // empty if not requested
336 ResultDocInfo_tarray docInfo; // empty if not requested
337
338 FilterResponse_t &operator=(const FilterResponse_t &x);
339};
340
341
342// DocumentRequest ::= SEQUENCE {
343// OID GeneralString,
344// docType GeneralString,
345// docFormat GeneralString
346// }
347struct DocumentRequest_t {
348 void clear ();
349 DocumentRequest_t () {clear();}
350
351 text_t OID;
352 text_t docType;
353 text_t docFormat;
354};
355
356
357// DocumentResponse ::= SEQUENCE {
358// doc OCTET STRING
359// }
360
361struct DocumentResponse_t {
362 void clear ();
363 DocumentResponse_t () {clear();}
364
365 text_t doc;
366};
367
368
369#endif
370
Note: See TracBrowser for help on using the repository browser.