Changeset 2545


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)

Location:
trunk/gsdl/src/colservr
Files:
6 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();
  • trunk/gsdl/src/colservr/collectset.h

    r1886 r2545  
    1616 protected:
    1717  collectservermapclass cservers;
     18  mgsearchclass         *mgsearch;
     19  mgppsearchclass       *mgppsearch;
    1820  int                   noofservers;
    1921  text_t                httpdomain;
  • trunk/gsdl/src/colservr/mgppsearch.cpp

    r1908 r2545  
    155155  // term info
    156156  termfreqclass term;
    157   for (int i=0; i<(int)queryResult.termFreqs.size(); i++) {
     157  for (int k=0; k<(int)queryResult.termFreqs.size(); k++) {
    158158    term.clear();
    159     term.termstr = GetCStr(queryResult.termFreqs[i].term);
     159    term.termstr = GetCStr(queryResult.termFreqs[k].term);
    160160    term.termstemstr = term.termstr;
    161     term.termfreq = queryResult.termFreqs[i].termFreq;
     161    term.termfreq = queryResult.termFreqs[k].termFreq;
    162162    queryresult.terms.push_back(term);
    163163    queryresult.orgterms.push_back(term); // should this change??
  • trunk/gsdl/src/colservr/mgsearch.cpp

    r2211 r2545  
    2222 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    2323 *
    24  * $Id$
    25  *
    2624 *********************************************************************/
    27 
    28 /*
    29    $Log$
    30    Revision 1.33  2001/03/20 09:34:41  sjboddie
    31    removed some debugging lines
    32 
    33    Revision 1.32  2001/03/12 23:57:17  say1
    34    added command to strip the corbaserver (makes it much smaller)
    35 
    36    Revision 1.31  2001/02/19 02:02:00  sjboddie
    37    Set mg's accumulator method back to 'list' as the recent change appeared
    38    to introduce a new (and more serious) bug while fixing the old bug. For
    39    now we'll just have to live with it the way it is.
    40 
    41    Revision 1.30  2001/02/15 22:58:11  kjm18
    42    added a comment
    43 
    44    Revision 1.29  2001/02/15 03:57:02  kjm18
    45    changed accumulator_method for mg to be array rather than list - it was
    46    getting some weird results with ranked searches
    47 
    48    Revision 1.28  2001/01/25 18:26:44  cs025
    49    Included CORBA branch for first time
    50 
    51    Revision 1.22.2.1  2000/04/04 15:02:32  cs025
    52    Corba first commit
    53 
    54    Revision 1.22  1999/09/24 02:41:21  rjmcnab
    55    change to use has_unicode_letdig in text_t
    56 
    57    Revision 1.21  1999/09/21 21:41:41  sjboddie
    58    fixed an error in what I committed last
    59 
    60    Revision 1.20  1999/09/21 11:59:26  sjboddie
    61    added Maxdocs queryfilter option (which may be -1 for 'all)
    62 
    63    Revision 1.19  1999/09/07 22:52:52  rjmcnab
    64    Seems to be an error in mg for retrieving documents using a paragraph
    65    based index for some cases. Just added a work around (loads the default
    66    index every time).
    67 
    68    Revision 1.18  1999/09/07 04:57:22  sjboddie
    69    added gpl notice
    70 
    71    Revision 1.17  1999/08/31 22:42:41  rjmcnab
    72    A couple of minor things.
    73 
    74    Revision 1.16  1999/08/25 04:51:06  sjboddie
    75    small change to allow for searching using boolean operators
    76 
    77    Revision 1.15  1999/07/16 08:35:03  rjmcnab
    78    Fixed a weird bug to do with a faulty case statement.
    79 
    80    Revision 1.14  1999/07/16 03:42:22  sjboddie
    81    changed isApprox
    82 
    83    Revision 1.13  1999/07/16 00:12:46  sjboddie
    84    removed all the old post-processing stuff
    85 
    86    Revision 1.12  1999/07/07 06:17:47  rjmcnab
    87    broke search_index into index+subcollection+language
    88    within mgsearch
    89 
    90    Revision 1.11  1999/07/05 21:06:43  rjmcnab
    91    Disabled quoted strings.
    92 
    93    Revision 1.10  1999/07/01 09:29:19  rjmcnab
    94    Changes for better reporting of number documents which match a query. Changes
    95    should still work as before with older versions of mg.
    96 
    97    Revision 1.9  1999/07/01 03:54:48  rjmcnab
    98    Added code to plug in the equivalent terms of each of the query terms.
    99    Also added a function to get a raw utf8 encoded mg document (for speeding
    100    up a phrase matching function)
    101 
    102    Revision 1.8  1999/06/30 04:04:12  rjmcnab
    103    made stemming functions available from mgsearch and made the stems
    104    for the query terms available in queryinfo
    105 
    106    Revision 1.7  1999/06/27 22:07:27  sjboddie
    107    got rid of all the old functions for dealing with dir indexes
    108 
    109    Revision 1.6  1999/06/09 00:41:32  sjboddie
    110    phrase searching now uses case-folding if it's turned on
    111 
    112    Revision 1.5  1999/02/21 22:31:35  rjmcnab
    113 
    114    Removed locateinfo.
    115 
    116    Revision 1.4  1999/02/03 01:13:27  sjboddie
    117 
    118    Got interface to handle subcollections and language subcollections -
    119    committed changes made to some of the collections
    120 
    121    Revision 1.3  1999/01/19 01:38:17  rjmcnab
    122 
    123    Made the source more portable.
    124 
    125    Revision 1.2  1999/01/12 01:51:02  rjmcnab
    126 
    127    Standard header.
    128 
    129    Revision 1.1  1999/01/08 09:02:16  rjmcnab
    130 
    131    Moved from src/library.
    132 
    133  */
    13425
    13526#include "gsdlconf.h"
     
    659550}
    660551
     552// unload_database simply calls mgq's close_all_databases function to clear
     553// any cached databases - this is useful when attempting to completely
     554// remove all trace of a collectionserver at runtime (when using a
     555// persistent version of Greenstone like the windows local library)
     556void mgsearchclass::unload_database () {
     557  close_all_databases();
     558}
  • trunk/gsdl/src/colservr/mgsearch.h

    r1907 r2545  
    5353  // the search results are returned in queryresults
    5454  // search returns 'true' if it was able to do a search
    55    bool search(const queryparamclass &queryparams,
     55  bool search(const queryparamclass &queryparams,
    5656          queryresultsclass &queryresults);
    5757 
     
    7979           char *&UDoc, int &ULen);
    8080
     81  // unload_database simply calls mgq's close_all_databases function to
     82  // clear any cached databases - this is useful when attempting to
     83  // completely remove all trace of a collectionserver at runtime (when
     84  // using a persistent version of Greenstone like the windows local
     85  // library)
     86  void mgsearchclass::unload_database ();
     87
     88
    8189protected:
    8290
  • trunk/gsdl/src/colservr/win32.mak

    r2338 r2545  
    3535DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX
    3636INCLUDES = -I"$(GSDLHOME)" -I"$(GSDLHOME)\lib" -I"$(GSDLHOME)\src\colservr" \
     37       -I"$(GSDLHOME)\src\mgpp\lib" -I"$(GSDLHOME)\src\mgpp\text" \
    3738       -I"$(GSDLHOME)\src\recpt" -I"$(GSDLHOME)\packages\mg" \
    3839       -I"$(GSDLHOME)\packages\mg\lib" -I"$(GSDLHOME)\packages\mg\src\text" \
     
    6061          colservrconfig.h maptools.h filter.h source.h browsefilter.h \
    6162          queryfilter.h mgqueryfilter.h mggdbmsource.h phrasesearch.h \
    62       phrasequeryfilter.h collectset.h
     63      phrasequeryfilter.h collectset.h mgppsearch.h mgppqueryfilter.h
    6364
    6465SOURCES = mgq.c search.cpp mgsearch.cpp querycache.cpp queryinfo.cpp \
     
    6667      source.cpp browsefilter.cpp queryfilter.cpp mgqueryfilter.cpp \
    6768      mggdbmsource.cpp phrasesearch.cpp phrasequeryfilter.cpp \
    68       collectset.cpp
     69      collectset.cpp mgppsearch.cpp mgppqueryfilter.cpp
    6970
    7071OBJECTS = mgq.obj search.obj mgsearch.obj querycache.obj queryinfo.obj \
     
    7273      source.obj browsefilter.obj queryfilter.obj mgqueryfilter.obj \
    7374      mggdbmsource.obj phrasesearch.obj phrasequeryfilter.obj \
    74       collectset.obj
     75      collectset.obj mgppsearch.obj mgppqueryfilter.obj
    7576
    7677all : gsdlcolservr.lib
Note: See TracChangeset for help on using the changeset viewer.