Changeset 196
- Timestamp:
- 1999-03-10T09:58:50+13:00 (25 years ago)
- Location:
- trunk/gsdl/src/colservr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/collectserver.cpp
r191 r196 12 12 /* 13 13 $Log$ 14 Revision 1.4 1999/03/09 20:58:50 rjmcnab 15 Added dummy filter and metadata results. 16 14 17 Revision 1.3 1999/03/08 05:07:42 rjmcnab 15 18 Made some alterations to fit with the changes to the comtypes. Added the … … 105 108 qfopt7.defaultValue = ""; 106 109 110 // -- onePerTerm Language enumerated 111 FilterOption_t &qfopt8 = queryfilter.filterOptions["Language"]; 112 qfopt8.name = "Language"; 113 qfopt8.type = FilterOption_t::enumeratedt; 114 qfopt8.repeatable = FilterOption_t::onePerTerm; 115 qfopt8.defaultValue = ""; 116 107 117 108 118 // set up the BrowseFilter information … … 143 153 // it contains. The configuration should take place just before initialisation. 144 154 void collectserver::configure (const text_t &key, const text_tarray &cfgline) { 145 if (key == "indexmap") configinfo.indexmap = cfgline; 146 else if (key == "subcollectionmap") configinfo.subcollectionmap = cfgline; 147 else if (key == "languagemap") configinfo.languagemap = cfgline; 148 149 else if (cfgline.size() >= 1) { 155 if (key == "indexmap") { 156 configinfo.indexmap.importmap (cfgline); 157 158 // update the list of indexes in the filter information 159 text_tarray options; 160 configinfo.indexmap.gettoarray (options); 161 update_enumfiltopt ("Index", options); 162 163 } else if (key == "subcollectionmap") { 164 configinfo.subcollectionmap.importmap (cfgline); 165 166 // update the list of subcollections in the filter information 167 text_tarray options; 168 configinfo.subcollectionmap.gettoarray (options); 169 update_enumfiltopt ("Subcollection", options); 170 171 } else if (key == "languagemap") { 172 configinfo.languagemap.importmap (cfgline); 173 174 // update the list of languages in the filter information 175 text_tarray options; 176 configinfo.languagemap.gettoarray (options); 177 update_enumfiltopt ("Language", options); 178 179 } else if (cfgline.size() >= 1) { 150 180 const text_t &value = cfgline[0]; 151 181 if (key == "gsdlhome") configinfo.gsdlhome = value; … … 206 236 void collectserver::get_filteroptions (InfoFilterOptionsResponse_t &response, 207 237 comerror_t &err, ostream &/*logout*/) { 208 238 response = filterinfo; 209 239 err = noError; 210 240 } … … 213 243 FilterResponse_t &response, 214 244 comerror_t &err, ostream &/*logout*/) { 245 response.clear(); 246 215 247 if (request.filterName == "QueryFilter") { 216 248 // return documents 217 218 249 response.docsFound = 2; 250 response.isApprox = false; 251 252 // fill in the term info 253 TermInfo_t terminfo; 254 terminfo.term = "the"; 255 terminfo.freq = 2; 256 terminfo.matchTerms.push_back ("the"); 257 terminfo.matchTerms.push_back ("The"); 258 response.termInfo.push_back (terminfo); 259 260 // fill in the document info 261 ResultDocInfo_t resultdoc; 262 resultdoc.OID = "HASH1234"; 263 resultdoc.ranking = 0.8; 264 resultdoc.docFreq.push_back (10); 265 response.docInfo.push_back (resultdoc); 266 267 resultdoc.clear(); 268 resultdoc.OID = "HASH2345"; 269 resultdoc.ranking = 0.5; 270 resultdoc.docFreq.push_back (5); 271 response.docInfo.push_back (resultdoc); 272 273 } else if (request.filterName == "BrowseFilter") { 274 // return documents 275 response.docsFound = 2; 276 response.isApprox = false; 277 278 // fill in the document info 279 ResultDocInfo_t resultdoc; 280 resultdoc.OID = "HASH2345"; 281 response.docInfo.push_back (resultdoc); 282 283 resultdoc.clear(); 284 resultdoc.OID = "HASH3456"; 285 response.docInfo.push_back (resultdoc); 286 219 287 } else { 288 err = protocolError; 289 return; 220 290 } 221 222 223 291 224 292 err = noError; … … 227 295 void collectserver::get_metadataoptions (MetadataInfoResponse_t &response, 228 296 comerror_t &err, ostream &/*logout*/) { 297 response.clear(); 298 299 response.supportedFields.insert ("Title"); 300 response.supportedFields.insert ("Creator"); 301 302 response.supportedLanguages.insert ("en"); 303 229 304 err = noError; 230 305 } … … 233 308 MetadataResponse_t &response, 234 309 comerror_t &err, ostream &/*logout*/) { 310 response.clear(); 311 312 text_tarray::const_iterator OIDs_here, OIDs_end, fields_here, fields_end, 313 languages_here, languages_end; 314 315 // for each object ID 316 OIDs_here = request.OIDs.begin(); 317 OIDs_end = request.OIDs.end(); 318 while (OIDs_here != OIDs_end) { 319 320 // and each field 321 fields_here = request.fields.begin(); 322 fields_end = request.fields.end(); 323 while (fields_here != fields_end) { 324 325 // and each language 326 languages_here = request.languages.begin(); 327 languages_end = request.languages.end(); 328 while (languages_here != languages_end) { 329 330 // return the metadata 331 text_t metadata = "Place holder"; 332 if (*OIDs_here == "HASH1234") { 333 if (*fields_here == "Title") metadata="The 1234 book"; 334 else if (*fields_here == "Creator") metadata="ME"; 335 336 } else if (*OIDs_here == "HASH2345") { 337 if (*fields_here == "Title") metadata="2345, come alive"; 338 else if (*fields_here == "Creator") metadata="Another person"; 339 340 } else if (*OIDs_here == "HASH3456") { 341 if (*fields_here == "Title") metadata="As easy as 3456"; 342 else if (*fields_here == "Creator") metadata="Bricks"; 343 } 344 345 response.metadata.push_back (metadata); 346 languages_here++; 347 } 348 349 fields_here++; 350 } 351 352 OIDs_here++; 353 } 354 235 355 err = noError; 236 356 } 237 357 358 void collectserver::update_enumfiltopt (text_t optionname, 359 const text_tarray &options) { 360 // update this option for each of the filters 361 FilterDescript_tmap::iterator filteropthere = filterinfo.filterOptions.begin(); 362 FilterDescript_tmap::iterator filteroptend = filterinfo.filterOptions.end(); 363 364 while (filteropthere != filteroptend) { 365 // see if this filter has an option with this name 366 FilterOption_tmap &fotm = (*filteropthere).second.filterOptions; 367 FilterOption_tmap::iterator fotm_iterator = fotm.find(optionname); 368 if (fotm_iterator != fotm.end()) { 369 // set the valid values to be the options 370 (*fotm_iterator).second.validValues = options; 371 372 // make sure the default is a valid value 373 (*fotm_iterator).second.check_defaultValue(); 374 } 375 376 filteropthere++; 377 } 378 } 238 379 239 380 -
trunk/gsdl/src/colservr/collectserver.h
r191 r196 17 17 #include "text_t.h" 18 18 #include "comtypes.h" 19 #include "maptools.h" 19 20 20 21 #if defined(GSDL_USE_OBJECTSPACE) … … 39 40 text_t collection; 40 41 text_t collectdir; 41 text_tarrayindexmap;42 text_tarraysubcollectionmap;43 text_tarraylanguagemap;42 stringmap indexmap; 43 stringmap subcollectionmap; 44 stringmap languagemap; 44 45 }; 45 46 … … 50 51 ColInfoResponse_t collectinfo; 51 52 InfoFilterOptionsResponse_t filterinfo; 53 52 54 public: 53 55 collectserver (); … … 84 86 MetadataResponse_t &response, 85 87 comerror_t &err, ostream &logout); 88 protected: 89 void update_enumfiltopt (text_t optionname, const text_tarray &options); 86 90 }; 87 91
Note:
See TracChangeset
for help on using the changeset viewer.