Changeset 9030
- Timestamp:
- 2005-02-14T17:20:06+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/collectset.cpp
r8032 r9030 35 35 #include "mgppqueryfilter.h" 36 36 #include "mggdbmsource.h" 37 38 #ifdef USE_LUCENE39 37 #include "lucenequeryfilter.h" 40 38 #include "lucenegdbmsource.h" 41 #endif42 39 43 40 #include "fileutil.h" … … 139 136 cserver->add_source (mggdbmsource); 140 137 } else if (buildtype == "lucene") { 141 #ifdef USE_LUCENE142 138 lucenesearch = new lucenesearchclass(); 143 139 … … 153 149 lucenegdbmsource->set_textsearchptr (lucenesearch); 154 150 cserver->add_source (lucenegdbmsource); 155 #else156 cerr << "Warning: Greenstone not compiled with Lucene support" << endl;157 #endif158 151 } 159 152 … … 241 234 } 242 235 236 237 void collectset::add_all_collections(const text_t &gsdlhome) { 238 239 text_tarray collections; 240 text_t collectdir = filename_cat(gsdlhome, "collect"); 241 if (read_dir(collectdir, collections)) { 242 243 text_tarray::const_iterator thiscol = collections.begin(); 244 text_tarray::const_iterator endcol = collections.end(); 245 246 while (thiscol != endcol) { 247 248 // ignore the modelcol 249 if (*thiscol == "modelcol") { 250 thiscol ++; 251 continue; 252 } 253 254 // create collection server and add to null protocol 255 this->add_collection (*thiscol, gsdlhome); 256 257 thiscol ++; 258 } 259 } 260 } 261 243 262 // add_collection sets up the collectionserver and calls 244 263 // add_collectserver 245 void collectset::add_collection (const text_t &collection, void *recpt,246 const text_t &gsdlhome , const text_t &gdbmhome) {264 void collectset::add_collection (const text_t &collection, 265 const text_t &gsdlhome) { 247 266 248 267 // if an old collection server exists for this collection we should … … 331 350 332 351 } else if (buildtype == "lucene") { 333 #ifdef USE_LUCENE334 352 lucenesearch = new lucenesearchclass(); 335 353 … … 345 363 lucenegdbmsource->set_textsearchptr (lucenesearch); 346 364 cserver->add_source (lucenegdbmsource); 347 #else348 cerr << "Warning: Greenstone not compiled with Lucene support" << endl;349 #endif350 351 365 } 352 366 … … 365 379 cservers.addcollectserver (cserver); 366 380 } 381 382 void collectset::remove_all_collections () { 383 384 // first unload any cached mg databases 385 if (mgsearch != NULL) { 386 mgsearch->unload_database(); 387 } 388 389 // now delete the collection server objects 390 collectservermapclass::iterator here = cservers.begin(); 391 collectservermapclass::iterator end = cservers.end(); 392 393 while (here != end) { 394 if ((*here).second.c != NULL) { 395 delete (*here).second.c; 396 } 397 here ++; 398 } 399 cservers.clear(); 400 } 401 367 402 368 403 // remove_collection deletes the collection server of collection.
Note:
See TracChangeset
for help on using the changeset viewer.