source: trunk/gsdl/src/recpt/comtypes.h@ 11985

Last change on this file since 11985 was 11985, checked in by kjdon, 18 years ago

no searchTypes array any more - it is now a format statement

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