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

Last change on this file since 357 was 353, checked in by rjmcnab, 25 years ago

Added the result number to the ResultDocInfo_t

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 8.7 KB
Line 
1/**********************************************************************
2 *
3 * comtypes.h --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: comtypes.h 353 1999-07-08 20:46:45Z rjmcnab $
9 *
10 *********************************************************************/
11
12
13#ifndef COMTYPES_H
14#define COMTYPES_H
15
16#include "gsdlconf.h"
17#include "text_t.h"
18
19#if defined(GSDL_USE_OBJECTSPACE)
20# include <ospace\std\vector>
21# include <ospace\std\list>
22# include <ospace\std\map>
23#elif defined(GSDL_USE_STL_H)
24# include <vector.h>
25# include <list.h>
26# include <map.h>
27#else
28# include <vector>
29# include <list>
30# include <map>
31#endif
32
33
34enum comerror_t {noError, authenticationFailure, protocolError,
35 configurationError, systemProblem};
36text_t get_comerror_string (comerror_t err);
37
38// ShortColInfo ::= SEQUENCE {
39// name GeneralString,
40// host GeneralString,
41// port INTEGER
42// }
43struct ShortColInfo_t {
44 void clear ();
45 ShortColInfo_t () {clear();}
46
47 text_t name;
48 text_t host;
49 int port;
50};
51
52
53// ColInfoResponse ::= SEQUENCE {
54// shortInfo [0] IMPLICIT ShortCollectionInfo,
55// isPublic [2] IMPLICIT BOOLEAN, -- whether has anonymous access
56// isBeta [3] IMPLICIT BOOLEAN, -- beta if still under development
57// buildDate [4] IMPLICIT GeneralizedTime,
58// languages [5] IMPLICIT StringSet, -- languages in the collection
59// numDocs [6] IMPLICIT INTEGER,
60// numWords [7] IMPLICIT INTEGER OPTIONAL,
61// numBytes [8] IMPLICIT INTEGER OPTIONAL
62// format [9] IMPLICIT StringSet
63// }
64struct ColInfoResponse_t {
65 void clear ();
66 ColInfoResponse_t () {clear();}
67
68 ShortColInfo_t shortInfo;
69 bool isPublic;
70 bool isBeta;
71 unsigned long buildDate;
72 text_tarray languages;
73 unsigned long numDocs; // 0 if not known
74 unsigned long numWords; // 0 if not known
75 unsigned long numBytes; // 0 if not known
76 text_tmap format;
77};
78
79
80// -- filter options which might be supported for the QueryFilter
81// --
82// -- onePerQuery StartResults integer
83// -- onePerQuery EndResults integer
84// -- onePerQuery QueryType enumerated (boolean, ranked)
85// -- onePerTerm Term string ???
86// -- onePerTerm Casefold boolean
87// -- onePerTerm Stem boolean
88// -- onePerTerm Index enumerated
89// -- onePerTerm Subcollection enumerated
90// --
91// -- filter options which might be supported for the BrowseFilter
92// --
93// -- onePerQuery StartResults integer
94// -- onePerQuery EndResults integer
95// -- onePerQuery ParentNode string ("" will return the browsing available)
96// --
97// -- The NullFilter always returns the set it was given, it doesn't have
98// -- any options
99
100// InfoFiltersResponse ::= SEQUENCE {
101// filterNames StringSet
102// }
103struct InfoFiltersResponse_t {
104 void clear ();
105
106 text_tset filterNames;
107};
108
109// InfoFilterOptionsRequest ::= SEQUENCE {
110// filterName GeneralString
111// }
112struct InfoFilterOptionsRequest_t {
113 void clear ();
114
115 text_t filterName;
116};
117
118// FilterOption ::= SEQUENCE {
119// name GeneralString,
120// type ENUMERATED {booleant(0), integert(1), enumeratedt(2), stringt(3)},
121// repeatable ENUMERATED {onePerQuery(0), onePerTerm(1), nPerTerm(2)},
122// defaultValue GeneralString,
123// -- the interpretation of the validValues depends on the type
124// -- for boolean: the first value is the false value, the second is true value
125// -- for integer: the first value is the minimum, the second the maximum
126// -- for enumerated: all values a listed
127// -- for string: this value is ignored
128// validValues StringSequence
129// }
130struct FilterOption_t {
131 void clear ();
132 void check_defaultValue ();
133 FilterOption_t () {clear();}
134
135 text_t name;
136
137 enum type_t {booleant=0, integert=1, enumeratedt=2, stringt=3};
138 type_t type;
139
140 enum repeatable_t {onePerQuery=0, onePerTerm=1, nPerTerm=2};
141 repeatable_t repeatable;
142
143 text_t defaultValue;
144 text_tarray validValues;
145};
146
147typedef map<text_t, FilterOption_t, lttext_t> FilterOption_tmap;
148
149
150// InfoFilterOptionsResponse ::= SEQUENCE {
151// filterOptions SET OF FilterOption
152// }
153struct InfoFilterOptionsResponse_t {
154 void clear ();
155
156 FilterOption_tmap filterOptions;
157};
158
159
160// OptionValue ::= SEQUENCE {
161// name GeneralString,
162// value GeneralString
163// }
164struct OptionValue_t {
165 void clear ();
166
167 text_t name;
168 text_t value;
169};
170
171typedef vector<OptionValue_t> OptionValue_tarray;
172
173
174// -- Terms are presented in the same order that they are requested,
175// -- any information relating to the terms is in reference to the
176// -- index specified for that term.
177// -- Metadata is presented in the same order that it is requested.
178//
179// FilterRequest ::= SEQUENCE {
180// filterName [0] GeneralString,
181// filterOptions [1] IMPLICIT SEQUENCE OF OptionValue,
182// docSet [2] IMPLICIT StringSequence, -- the OID "" represents everything
183// filterResultOptions [3] IMPLICIT BIT STRING {termFreq(0), matchTerms(1), OID(2),
184// subCol(3), ranking(4), docFreq(5),
185// metadata(6)}
186//
187// -- the next set of options are for the metadata request,
188// -- they can be left blank if metadata is not wanted
189// requestParams [4] IMPLICIT GeneralString, -- used to negotiate the metadata content
190// refParams [5] IMPLICIT GeneralString, -- used to decide whether to return a
191// -- reference to the data or the actual data
192// fields [6] IMPLICIT StringSequence
193// getParents [7] IMPLICIT BOOLEAN -- gets metadata of all parents too
194// }
195#define FRtermFreq 1
196#define FRmatchTerms 2
197#define FROID 4
198#define FRsubCol 8
199#define FRranking 16
200#define FRdocFreq 32
201#define FRmetadata 64
202
203struct FilterRequest_t {
204 void clear ();
205 FilterRequest_t () {clear();}
206
207 text_t filterName;
208 OptionValue_tarray filterOptions;
209 text_tset docSet; // empty if not used
210 int filterResultOptions; // use the FR* defines above
211
212 text_t requestParams; // empty if not used
213 text_t refParams; // empty if not used
214 text_tarray fields; // empty if not used
215 bool getParents; // defaults to false
216};
217
218
219// TermInfo ::= SEQUENCE {
220// term [0] GeneralString,
221// freq [1] IMPLICIT INTEGER, -- 0 if not requested
222// matchTerms [2] IMPLICIT StringSequence -- empty if not requested
223// }
224struct TermInfo_t {
225 void clear ();
226 TermInfo_t () {clear();}
227
228 text_t term;
229 int freq; // 0 if not requested
230 text_tarray matchTerms; // empty if not requested
231};
232
233typedef vector<TermInfo_t> TermInfo_tarray;
234
235
236// MetadataInfo ::= SEQUENCE {
237// params [0] IMPLICIT GeneralString,
238// isRef [1] IMPLICIT BOOLEAN,
239// values [3] IMPLICIT SEQUENCE OF GeneralString
240// }
241struct MetadataInfo_t {
242 void clear ();
243 MetadataInfo_t () {clear();}
244
245 text_t params;
246 bool isRef;
247 text_tarray values;
248};
249
250typedef vector<MetadataInfo_t> MetadataInfo_tarray;
251
252
253// ResultDocInfo ::= SEQUENCE {
254// OID [0] IMPLICIT GeneralString,
255// ranking [1] IMPLICIT INTEGER, -- 0 if not requested, range 0-10000
256// docFreq [2] IMPLICIT SEQUENCE OF INTEGER, -- empty if not requested
257// metadata [3] IMPLICIT SEQUENCE OF MetadataInfo
258// }
259struct ResultDocInfo_t {
260 void clear ();
261 ResultDocInfo_t () {clear();}
262
263 text_t OID;
264 int result_num; // place in results list
265 int ranking; // 0 if not requested (real ranking*10000)
266 int num_terms_matched; // not available on all versions of mg
267 int num_phrase_match; // not available on all versions of mg
268
269 vector<int> docFreq; // empty if not requested
270 MetadataInfo_tarray metadata; // empty if not requested
271
272 ResultDocInfo_t &operator=(const ResultDocInfo_t &x);
273};
274
275typedef vector<ResultDocInfo_t> ResultDocInfo_tarray;
276
277
278// FilterResponse ::= SEQUENCE {
279// numDocs [0] IMPLICIT INTEGER,
280// isApprox [1] IMPLICIT BOOLEAN, -- whether numDocs is approximate
281// termInfo [2] IMPLICIT SEQUENCE OF TermInfo, -- empty if not required
282// docInfo [3] IMPLICIT SEQUENCE OF ResultDocInfo -- empty if not required
283// }
284struct FilterResponse_t {
285 void clear ();
286 FilterResponse_t () {clear();}
287
288 int numDocs;
289 bool isApprox; // some versions of mg might be more 'approximate' than others :-)
290 TermInfo_tarray termInfo; // empty if not requested
291 ResultDocInfo_tarray docInfo; // empty if not requested
292};
293
294
295// DocumentRequest ::= SEQUENCE {
296// OID GeneralString,
297// docType GeneralString,
298// docFormat GeneralString
299// }
300struct DocumentRequest_t {
301 void clear ();
302 DocumentRequest_t () {clear();}
303
304 text_t OID;
305 text_t docType;
306 text_t docFormat;
307};
308
309
310// DocumentResponse ::= SEQUENCE {
311// doc OCTET STRING
312// }
313
314struct DocumentResponse_t {
315 void clear ();
316 DocumentResponse_t () {clear();}
317
318 text_t doc;
319};
320
321
322#endif
Note: See TracBrowser for help on using the repository browser.