Ignore:
Timestamp:
2001-06-13T15:16:57+12:00 (23 years ago)
Author:
sjboddie
Message:

Added an unload_database() function to mgsearchclass which is called by
collectset's remove_collection() function. This fixes a bug that was
present when using the windows local library (or any persistent server
form of Greenstone) to edit an existing collection from the collector (i.e.
the collector occassionally couldn't delete the existing indexes because
they were being held open by mg).

Also removed #ifdefs that were disabling the use of mgpp collections on
Windows and got mgppqueryfilter and mgppsearch compiling on Windows. mgpp
collections should now work on Windows exactly as they do on Unix (I
haven't tested it yet though)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/collectset.cpp

    r2344 r2545  
    105105     
    106106      if (buildtype == "mg") {
    107         mgsearchclass *mgsearch = new mgsearchclass();
     107        mgsearch = new mgsearchclass();
    108108       
    109109        // add a query filter
     
    118118        mggdbmsource->set_mgsearchptr (mgsearch);
    119119        cserver->add_source (mggdbmsource);
    120       }
    121 #ifndef __WIN32__
    122      
    123       else if (buildtype == "mgpp") {
    124        
    125         mgppsearchclass *mgsearch = new mgppsearchclass();
     120
     121      } else if (buildtype == "mgpp") {
     122       
     123        mgppsearch = new mgppsearchclass();
    126124       
    127125        // add a query filter
    128126        mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
    129127        queryfilter->set_gdbmptr (gdbmhandler);
    130         queryfilter->set_mgsearchptr (mgsearch);
     128        queryfilter->set_mgsearchptr (mgppsearch);
    131129        cserver->add_filter (queryfilter);
    132130       
     
    137135        cserver->add_source (mggdbmsource);   
    138136      }
    139 #endif
    140137     
    141138      // inform collection server and everything it contains about its
     
    231228  // do this would be preferable though - Stefan.
    232229  text_t buildtype = "mg"; // mg is default
    233   // (for now we'll just ignore mgpp if on windows)
    234 #ifndef __WIN32__
     230
    235231  text_tarray cfgline;
    236232  text_t key;
     
    253249  }
    254250  delete build_cfgc;
    255 #endif
    256251
    257252  collectserver *cserver = new collectserver();
     
    269264 
    270265  if (buildtype == "mg") {
    271     mgsearchclass *mgsearch = new mgsearchclass();
     266    mgsearch = new mgsearchclass();
    272267 
    273268    // add a query filter
     
    282277    mggdbmsource->set_mgsearchptr (mgsearch);
    283278    cserver->add_source (mggdbmsource);
    284   }
    285 
    286 #ifndef __WIN32__
    287 
    288   else if (buildtype == "mgpp") {
     279
     280  } else if (buildtype == "mgpp") {
    289281     
    290     mgppsearchclass *mgsearch = new mgppsearchclass();
     282    mgppsearch = new mgppsearchclass();
    291283
    292284    // add a query filter
    293285    mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass();
    294286    queryfilter->set_gdbmptr (gdbmhandler);
    295     queryfilter->set_mgsearchptr (mgsearch);
     287    queryfilter->set_mgsearchptr (mgppsearch);
    296288    cserver->add_filter (queryfilter);
    297289     
     
    303295   
    304296  }
    305 #endif   
    306297
    307298  // inform collection server and everything it contains about its
     
    324315// cleans up all collectservers when the program exits.
    325316void collectset::remove_collection (const text_t &collection, ostream &logout) {
     317
     318  // first unload any cached mg databases - we may need to do something
     319  // similar to this for mgpp too
     320  if (mgsearch != NULL) {
     321    mgsearch->unload_database();
     322  }
     323
     324  // now delete the collection server object
    326325  collectservermapclass::iterator here = cservers.begin();
    327326  collectservermapclass::iterator end = cservers.end();
Note: See TracChangeset for help on using the changeset viewer.