Show
Ignore:
Timestamp:
09.12.2009 21:41:14 (10 years ago)
Author:
ak19
Message:

Changes to makefiles, configure files, and source code to work with the new configure flags that allow indexers to be individually compiled up by setting each indexer to be enabled or disabled (enable-mg, enable-mgpp, enable-lucene)

Location:
main/trunk/greenstone2/runtime-src/src/colservr
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in

    r18224 r21324  
    3131COMMON_PACKAGES_DIR = $(COMMON_DIR)/packages 
    3232 
     33# NOTE: phrasequeryfilter inherits from mgqueryfilter and uses mgsearch 
     34ENABLE_MG = @ENABLE_MG@ 
     35ifeq ($(ENABLE_MG), 1) 
     36MG_SOURCES = mgq.c \ 
     37    mgqueryfilter.cpp \ 
     38    mgsearch.cpp \ 
     39    mgsource.cpp \ 
     40    phrasequeryfilter.cpp 
     41MG_OBJECTS = mgq.o \ 
     42    mgqueryfilter.o \ 
     43    mgsearch.o \ 
     44    mgsource.o \ 
     45    phrasequeryfilter.o 
     46MG_INCLUDES = -I$(INDEXERS_DIR)/mg -I$(INDEXERS_DIR)/mg/lib -I$(INDEXERS_DIR)/mg/src/text 
     47else 
     48MG_SOURCES = 
     49MG_OBJECTS = 
     50MG_INCLUDES = 
     51endif 
     52 
     53ENABLE_MGPP = @ENABLE_MGPP@ 
     54ifeq ($(ENABLE_MGPP), 1) 
     55MGPP_SOURCES = mgppqueryfilter.cpp \ 
     56    mgppsearch.cpp \ 
     57    mgppsource.cpp 
     58MGPP_OBJECTS = mgppqueryfilter.o \ 
     59    mgppsearch.o \ 
     60    mgppsource.o 
     61MGPP_INCLUDES = -I$(INDEXERS_DIR)/mgpp/lib -I$(INDEXERS_DIR)/mgpp/text 
     62else 
     63MGPP_SOURCES = 
     64MGPP_OBJECTS = 
     65MGPP_INCLUDES = 
     66endif 
     67 
     68 
     69ENABLE_LUCENE = @ENABLE_LUCENE@ 
     70ifeq ($(ENABLE_LUCENE), 1) 
     71LUCENE_SOURCES = lucenequeryfilter.cpp \ 
     72    lucenesearch.cpp \ 
     73    lucenesource.cpp 
     74LUCENE_OBJECTS = lucenequeryfilter.o \ 
     75    lucenesearch.o \ 
     76    lucenesource.o 
     77else 
     78LUCENE_SOURCES = 
     79LUCENE_OBJECTS = 
     80endif 
     81 
    3382 
    3483USE_SQLITE = @USE_SQLITE@ 
     
    5099# Do NOT add the "recpt" directory here: the colserver should be independent of the receptionist! 
    51100INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib -I$(COMMON_PACKAGES_DIR)/gdbm/include \ 
    52     -I$(INDEXERS_DIR)/mg -I$(INDEXERS_DIR)/mg/lib -I$(INDEXERS_DIR)/mg/src/text \ 
    53     -I$(INDEXERS_DIR)/mgpp/lib -I$(INDEXERS_DIR)/mgpp/text \ 
     101    $(MG_INCLUDES) \ 
     102    $(MGPP_INCLUDES) \ 
    54103    -I$(COMMON_PACKAGES_DIR)/expat/include $(SQLITE_INCLUDES) 
    55104RANLIB = @RANLIB@ 
     
    79128    expat_resultset.cpp \ 
    80129    filter.cpp \ 
    81     lucenequeryfilter.cpp \ 
    82     lucenesearch.cpp \ 
    83     lucenesource.cpp \ 
     130    $(LUCENE_SOURCES) \ 
    84131    maptools.cpp \ 
    85     mgq.c \ 
    86     mgqueryfilter.cpp \ 
    87     mgsearch.cpp \ 
    88     mgsource.cpp \ 
    89     mgppqueryfilter.cpp \ 
    90     mgppsearch.cpp \ 
    91     phrasequeryfilter.cpp \ 
     132    $(MG_SOURCES) \ 
     133    $(MGPP_SOURCES) \ 
    92134    phrasesearch.cpp \ 
    93135    querycache.cpp \ 
     
    107149    expat_resultset.o \ 
    108150    filter.o \ 
    109     lucenequeryfilter.o \ 
    110     lucenesearch.o \ 
    111     lucenesource.o \ 
     151    $(LUCENE_OBJECTS) \ 
    112152    maptools.o \ 
    113     mgq.o \ 
    114     mgqueryfilter.o \ 
    115     mgsearch.o \ 
    116     mgsource.o \ 
    117     mgppqueryfilter.o \ 
    118     mgppsearch.o \ 
    119     phrasequeryfilter.o \ 
     153    $(MG_OBJECTS) \ 
     154    $(MGPP_OBJECTS) \ 
    120155    phrasesearch.o \ 
    121156    querycache.o \ 
  • main/trunk/greenstone2/runtime-src/src/colservr/collectserver.cpp

    r20799 r21324  
    2929#include <assert.h> 
    3030#include "display.h" 
     31 
     32void check_if_valid_buildtype(const text_t& buildtype) 
     33{ 
     34  if (buildtype=="mg") { 
     35#ifndef ENABLE_MG 
     36    cerr << "Warning: Greenstone installation has not been compiled to support buildtype 'mg'." << endl; 
     37#endif 
     38  } 
     39 
     40  else if (buildtype=="mgpp") { 
     41#ifndef ENABLE_MGPP 
     42    cerr << "Warning: Greenstone installation has not been compiled to support buildtype 'mgpp'." << endl; 
     43#endif 
     44  } 
     45 
     46  else if (buildtype=="lucene") { 
     47#ifndef ENABLE_LUCENE 
     48    cerr << "Warning: Greenstone installation has not been compiled to support buildtype 'lucene'." << endl; 
     49#endif 
     50  } 
     51 
     52  else { 
     53    cerr << "Error: buildtype '" << buildtype << "' is not a recognized indexer for Greenstone." << endl; 
     54  } 
     55 
     56} 
     57 
    3158 
    3259 
     
    202229    else if (key == "httpprefix") collectinfo.httpprefix = value; 
    203230    else if (key == "receptionist") collectinfo.receptionist = value; 
    204     else if (key == "buildtype") collectinfo.buildType = value; 
     231    else if (key == "buildtype") { 
     232      check_if_valid_buildtype(value); // prints warning if value (indexer) is invalid 
     233      collectinfo.buildType = value; 
     234    } 
    205235    // backwards compatibility - searchytpes is now a format statement 
    206236    else if (key == "searchtype") { // means buildtype is mgpp 
    207237      if (collectinfo.buildType.empty()) { 
     238    check_if_valid_buildtype("mgpp"); // prints warning if value (indexer) is invalid 
    208239    collectinfo.buildType = "mgpp"; 
    209240      } 
  • main/trunk/greenstone2/runtime-src/src/colservr/collectset.cpp

    r19806 r21324  
    3636#include "sqlbrowsefilter.h" 
    3737#include "queryfilter.h" 
     38 
     39#ifdef ENABLE_MG 
    3840#include "mgqueryfilter.h" 
     41#include "mgsource.h" 
     42#endif 
     43#ifdef ENABLE_MGPP 
    3944#include "mgppqueryfilter.h" 
    40 #include "mgsource.h" 
     45#include "mgppsource.h" 
     46#endif 
     47#ifdef ENABLE_LUCENE 
    4148#include "lucenequeryfilter.h" 
    4249#include "lucenesource.h" 
     50#endif 
    4351 
    4452#include <assert.h> 
     
    6169  text_tarray collections; 
    6270 
     71#ifdef ENABLE_MG 
    6372  mgsearch = NULL; 
     73#endif 
     74#ifdef ENABLE_MGPP 
    6475  mgppsearch = NULL; 
     76#endif 
     77#ifdef ENABLE_LUCENE 
    6578  lucenesearch = NULL; 
     79#endif 
    6680 
    6781  // get gsdlhome (if we fail the error will be picked up later -- in 
     
    100114  httpprefix = httpprefix_arg; 
    101115 
     116#ifdef ENABLE_MG 
    102117  mgsearch = NULL; 
     118#endif 
     119#ifdef ENABLE_MGPP 
    103120  mgppsearch = NULL; 
     121#endif 
     122#ifdef ENABLE_LUCENE 
    104123  lucenesearch = NULL; 
     124#endif 
    105125 
    106126} 
     
    108128collectset::collectset () 
    109129{ 
     130#ifdef ENABLE_MG 
    110131  mgsearch = NULL; 
     132#endif 
     133#ifdef ENABLE_MGPP 
    111134  mgppsearch = NULL; 
     135#endif 
     136#ifdef ENABLE_LUCENE 
    112137  lucenesearch = NULL; 
     138#endif 
    113139} 
    114140 
     
    310336 
    311337    if (buildtype == "mg") { 
     338#ifdef ENABLE_MG 
    312339      mgsearch = new mgsearchclass(); 
    313340  
     
    323350      mgsource->set_textsearchptr (mgsearch); 
    324351      cserver->add_source (mgsource); 
     352#else 
     353      cerr << "Error: buildtype " << buildtype << " not enabled." << endl; 
     354#endif 
    325355    } 
    326356    else if (buildtype == "mgpp") { 
     357#ifdef ENABLE_MGPP 
    327358      mgppsearch = new mgppsearchclass(); 
    328359 
     
    333364      cserver->add_filter (queryfilter); 
    334365       
    335       // add a mg source 
    336       mgsourceclass *mgsource = new mgsourceclass (); 
    337       mgsource->set_db_ptr(db_ptr); 
    338       mgsource->set_textsearchptr (mgppsearch); 
    339       cserver->add_source (mgsource); 
     366      // add a mgpp source 
     367      mgppsourceclass *mgppsource = new mgppsourceclass (); 
     368      mgppsource->set_db_ptr(db_ptr); 
     369      mgppsource->set_textsearchptr (mgppsearch); 
     370      cserver->add_source (mgppsource); 
     371#else 
     372      cerr << "Error: buildtype " << buildtype << " not enabled." << endl; 
     373#endif 
    340374    } 
    341375    else if (buildtype == "lucene") { 
     376#ifdef ENABLE_LUCENE 
    342377      lucenesearch = new lucenesearchclass(); 
    343378      lucenesearch->set_gsdlhome(gsdlhome);  
     
    354389      lucenesource->set_textsearchptr (lucenesearch); 
    355390      cserver->add_source (lucenesource); 
     391#else 
     392      cerr << "Error: buildtype " << buildtype << " not enabled." << endl; 
     393#endif 
    356394    } 
    357395    else { 
    358       cerr << "Warning: unrecognized buildtype" << buildtype << endl; 
     396      cerr << "Warning: unrecognized buildtype " << buildtype << endl; 
    359397    } 
    360398 
     
    414452void collectset::remove_all_collections () { 
    415453 
     454#ifdef ENABLE_MG 
    416455  // first unload any cached mg databases 
    417456  if (mgsearch != NULL) { 
    418457    mgsearch->unload_database(); 
    419458  } 
     459#endif 
    420460 
    421461  // now delete the collection server objects 
     
    512552  if (cservers.getcollectserver(collection) == NULL) return; 
    513553 
     554#ifdef ENABLE_MG 
    514555  // first unload any cached mg databases - we may need to do something 
    515556  // similar to this for mgpp and lucene too 
     
    517558    mgsearch->unload_database(); 
    518559  } 
     560#endif 
    519561 
    520562  // now delete the collection server object 
  • main/trunk/greenstone2/runtime-src/src/colservr/collectset.h

    r19365 r21324  
    1010#include "collectserver.h" 
    1111#include "cnfgable.h" 
     12 
     13#ifdef ENABLE_MG 
    1214#include "mgsearch.h" 
     15#endif 
     16#ifdef ENABLE_MGPP 
    1317#include "mgppsearch.h" 
     18#endif 
     19#ifdef ENABLE_LUCENE 
    1420#include "lucenesearch.h" 
     21#endif 
    1522 
    1623class collectset : public configurable 
     
    1825 protected: 
    1926  collectservermapclass cservers; 
     27#ifdef ENABLE_MG 
    2028  mgsearchclass         *mgsearch; 
     29#endif 
     30#ifdef ENABLE_MGPP 
    2131  mgppsearchclass       *mgppsearch; 
     32#endif 
     33#ifdef ENABLE_LUCENE 
    2234  lucenesearchclass     *lucenesearch; 
     35#endif 
     36 
    2337  int                   noofservers; 
    2438  text_t                httpdomain; 
  • main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.cpp

    r15558 r21324  
    111111} 
    112112 
     113#ifdef ENABLE_MG 
    113114bool doc_phrase_search (unsigned char *doc, int doclen, 
    114115            const termfreqclassarray &phrase) { 
     
    258259  return result; 
    259260} 
     261#endif 
  • main/trunk/greenstone2/runtime-src/src/colservr/phrasesearch.h

    r15595 r21324  
    3131#include "text_t.h" 
    3232#include "unitool.h" 
     33 
     34#ifdef ENABLE_MG 
    3335#include "mgsearch.h" 
     36#endif 
     37 
    3438#include "dbclass.h" 
    3539 
     
    3842// a document number. This function has not been coded with all 
    3943// situations in mind and expects mgsearch and db set up ready to go 
     44#ifdef ENABLE_MG 
    4045bool OID_phrase_search (mgsearchclass &mgsearch, 
    4146            dbclass &db, 
     
    4752            const termfreqclassarray &phrase, 
    4853            int docnum); 
     54#endif 
    4955 
    5056#endif 
  • main/trunk/greenstone2/runtime-src/src/colservr/win32.mak

    r19521 r21324  
    3939USE_SQLITE = 1 
    4040USE_MSSQL = 0 
     41ENABLE_MG = 1 
     42ENABLE_MGPP = 1 
     43ENABLE_LUCENE = 1 
    4144 
    4245!IF $(DEBUG) 
     
    6164!ENDIF 
    6265 
    63 !IF $(USE_SQLITE) 
     66!IF "$(USE_SQLITE)" == "0" 
     67SQLITE_DEFINES =  
     68SQLITE_INCLUDES =  
     69!ELSE 
    6470SQLITE_DEFINES = -DUSE_SQLITE 
    6571SQLITE_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\sqlite\include" 
    66 !ELSE 
    67 SQLITE_DEFINES =  
    68 SQLITE_INCLUDES =  
    6972!ENDIF 
    7073 
     
    7376!ELSE 
    7477MSSQL_DEFINES =  
     78!ENDIF 
     79 
     80!IF "$(ENABLE_MG)" == "0" 
     81MG_DEFS = 
     82MG_SOURCES = 
     83MG_OBJECTS = 
     84MG_INCLUDES = 
     85!ELSE 
     86MG_DEFS = -DENABLE_MG 
     87MG_SOURCES = mgq.c \ 
     88    mgqueryfilter.cpp \ 
     89    mgsearch.cpp \ 
     90    phrasequeryfilter.cpp \ 
     91    mgsource.cpp 
     92MG_OBJECTS = mgq.obj \ 
     93    mgqueryfilter.obj \ 
     94    mgsearch.obj \ 
     95    phrasequeryfilter.obj \ 
     96    mgsource.obj 
     97MG_INCLUDES = -I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text" 
     98!ENDIF 
     99 
     100!IF "$(ENABLE_MGPP)" == "0" 
     101MGPP_DEFS = 
     102MGPP_SOURCES = 
     103MGPP_OBJECTS = 
     104MGPP_INCLUDES = 
     105!ELSE 
     106MGPP_DEFS = -DENABLE_MGPP 
     107MGPP_SOURCES = mgppqueryfilter.cpp \ 
     108    mgppsearch.cpp \ 
     109    mgppsource.cpp 
     110MGPP_OBJECTS = mgppqueryfilter.obj \ 
     111    mgppsearch.obj \ 
     112    mgppsource.obj 
     113MGPP_INCLUDES = -I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text" 
     114!ENDIF 
     115 
     116!IF "$(ENABLE_LUCENE)" == "0" 
     117LUCENE_DEFS = 
     118!ELSE 
     119LUCENE_DEFS = -DENABLE_LUCENE 
    75120!ENDIF 
    76121 
     
    79124CC = cl 
    80125DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \ 
    81         -DXML_STATIC $(SQLITE_DEFINES) $(MSSQL_DEFINES) 
     126        -DXML_STATIC $(SQLITE_DEFINES) $(MSSQL_DEFINES) $(MG_DEFS) $(MGPP_DEFS) $(LUCENE_DEFS) 
    82127# Do NOT add the "recpt" directory here: the colserver should be independent of the receptionist! 
    83128INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" \ 
    84     -I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text" \ 
    85     -I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text" \ 
     129    $(MG_INCLUDES) \ 
     130    $(MGPP_INCLUDES) \ 
    86131    -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows" \ 
    87132    -I"$(COMMON_PACKAGES_DIR)\windows\expat\expat" $(SQLITE_INCLUDES) 
     
    119164    lucenesource.cpp \ 
    120165    maptools.cpp \ 
    121     mgq.c \ 
    122     mgqueryfilter.cpp \ 
    123     mgsearch.cpp \ 
    124     mgsource.cpp \ 
    125     mgppqueryfilter.cpp \ 
    126     mgppsearch.cpp \ 
    127     phrasequeryfilter.cpp \ 
     166    $(MG_SOURCES) \ 
     167    $(MGPP_SOURCES) \ 
    128168    phrasesearch.cpp \ 
    129169    querycache.cpp \ 
     
    147187    lucenesource.obj \ 
    148188    maptools.obj \ 
    149     mgq.obj \ 
    150     mgqueryfilter.obj \ 
    151     mgsearch.obj \ 
    152     mgsource.obj \ 
    153     mgppqueryfilter.obj \ 
    154     mgppsearch.obj \ 
    155     phrasequeryfilter.obj \ 
     189    $(MG_OBJECTS) \ 
     190    $(MGPP_OBJECTS) \ 
    156191    phrasesearch.obj \ 
    157192    querycache.obj \