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

Last change on this file since 15207 was 15002, checked in by davidb, 16 years ago

Collections can now be put in to "groups" i.e. can be located inside another collection, which is marked as "collectgroup" true. The top-level collection appears on the home page, and when clicked upon display a new "home page" with only the collections appearing within its folder displayed. To implement this, the main change is in collectset.cpp, which now runs "add_all_collection_groups" after it has added all the top-level collections. comtypes.h has been updated to include the new field, "isCollectGroup". Finally, pageaction.cpp has been updated so these changes are reflected in the home page generated.

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