Changeset 15558
- Timestamp:
- 2008-05-17T16:00:00+12:00 (16 years ago)
- Location:
- gsdl/trunk/src/colservr
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/colservr/browsefilter.cpp
r13780 r15558 30 30 31 31 browsefilterclass::browsefilterclass () { 32 gdbmptr = NULL;32 db_ptr = NULL; 33 33 34 34 // -- onePerQuery StartResults integer … … 80 80 } 81 81 // get the filename for the database and make sure it exists 82 gdbm_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem);83 84 if (littleEndian()) gdbm_filename += ".ldb";85 else gdbm_filename += ".bdb";86 87 if (!file_exists( gdbm_filename)) {82 db_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem); 83 84 if (littleEndian()) db_filename += ".ldb"; 85 else db_filename += ".bdb"; 86 87 if (!file_exists(db_filename)) { 88 88 logout << text_t2ascii 89 << "warning: gdbm database \"" //**** 90 << gdbm_filename << "\" does not exist\n\n"; 91 // return false; //**** 89 << "warning: database \"" << db_filename << "\" does not exist\n\n"; 90 // return false; 92 91 } 93 92 … … 103 102 response.clear (); 104 103 err = noError; 105 if ( gdbmptr == NULL) {104 if (db_ptr == NULL) { 106 105 // most likely a configuration problem 107 106 logout << text_t2ascii 108 << "configuration error: browsefilter contains a null gdbmclass\n\n";107 << "configuration error: browsefilter contains a null dbclass\n\n"; 109 108 err = configurationError; 110 109 return; … … 112 111 113 112 // open the database 114 gdbmptr->setlogout(&logout); 115 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 116 // most likely a system problem (we have already checked that the 117 // gdbm database exists) 113 db_ptr->setlogout(&logout); 114 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 115 // most likely a system problem (we have already checked that the database exists) 118 116 logout << text_t2ascii 119 << "system problem: open on gdbmdatabase \""120 << gdbm_filename << "\" failed\n\n";117 << "system problem: open on database \"" 118 << db_filename << "\" failed\n\n"; 121 119 err = systemProblem; 122 120 return; … … 149 147 150 148 // translate any ".fc", ".pr" etc. stuff in the parentnode 151 parentnode = gdbmptr->translate_OID (parentnode, info);149 parentnode = db_ptr->translate_OID (parentnode, info); 152 150 153 151 // adjust topmost browsing node … … 157 155 if ((request.filterResultOptions & FROID) || 158 156 (request.filterResultOptions & FRmetadata)) { 159 if (! gdbmptr->getinfo(parentnode, info)) {157 if (!db_ptr->getinfo(parentnode, info)) { 160 158 // didn't find the node 161 159 logout << text_t2ascii … … 304 302 } 305 303 306 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open304 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 307 305 response.numDocs = numDocs; 308 306 response.isApprox = Exact; -
gsdl/trunk/src/colservr/browsefilter.h
r15430 r15558 33 33 #include "comtypes.h" 34 34 #include "filter.h" 35 #include " gdbmclass.h"35 #include "dbclass.h" 36 36 37 37 38 38 class browsefilterclass : public filterclass { 39 39 protected: 40 text_t gdbm_filename;40 text_t db_filename; 41 41 text_t indexstem; 42 gdbmclass *gdbmptr;42 dbclass *db_ptr; 43 43 44 44 public: … … 50 50 virtual void configure (const text_t &key, const text_tarray &cfgline); 51 51 52 // the gdbmptr remains the responsability of the calling code and52 // the db ptr remains the responsability of the calling code and 53 53 // should be destroyed after this browsefilter is destroyed 54 void set_ gdbmptr (gdbmclass *thegdbmptr) {gdbmptr = thegdbmptr;}54 void set_db_ptr (dbclass *db_ptr_arg) { db_ptr = db_ptr_arg; } 55 55 56 56 bool init (ostream &logout); -
gsdl/trunk/src/colservr/collectset.cpp
r15430 r15558 224 224 // add a browse filter 225 225 browsefilterclass *browsefilter = new browsefilterclass(); 226 browsefilter->set_ gdbmptr(gdbmhandler);226 browsefilter->set_db_ptr(gdbmhandler); 227 227 228 228 cserver->add_filter (browsefilter); … … 233 233 // add a query filter 234 234 mgqueryfilterclass *queryfilter = new mgqueryfilterclass(); 235 queryfilter->set_ gdbmptr(gdbmhandler);235 queryfilter->set_db_ptr(gdbmhandler); 236 236 queryfilter->set_textsearchptr (mgsearch); 237 237 cserver->add_filter (queryfilter); … … 248 248 // add a query filter 249 249 mgppqueryfilterclass *queryfilter = new mgppqueryfilterclass(); 250 queryfilter->set_ gdbmptr(gdbmhandler);250 queryfilter->set_db_ptr(gdbmhandler); 251 251 queryfilter->set_textsearchptr (mgppsearch); 252 252 cserver->add_filter (queryfilter); … … 264 264 // add a query filter 265 265 lucenequeryfilterclass *queryfilter = new lucenequeryfilterclass(); 266 queryfilter->set_ gdbmptr(gdbmhandler);266 queryfilter->set_db_ptr(gdbmhandler); 267 267 queryfilter->set_textsearchptr (lucenesearch); 268 268 cserver->add_filter (queryfilter); -
gsdl/trunk/src/colservr/lucenequeryfilter.cpp
r13780 r15558 122 122 response.clear (); 123 123 err = noError; 124 if ( gdbmptr == NULL) {124 if (db_ptr == NULL) { 125 125 // most likely a configuration problem 126 126 logout << text_t2ascii 127 << "configuration error: queryfilter contains a null gdbmclass\n\n";127 << "configuration error: queryfilter contains a null dbclass\n\n"; 128 128 err = configurationError; 129 129 return; … … 141 141 } 142 142 // open the database 143 gdbmptr->setlogout(&logout); 144 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 145 // most likely a system problem (we have already checked that the 146 // gdbm database exists) 143 db_ptr->setlogout(&logout); 144 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 145 // most likely a system problem (we have already checked that the database exists) 147 146 logout << text_t2ascii 148 << "system problem: open on gdbm database \"" 149 << gdbm_filename << "\" failed\n\n"; 147 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 150 148 err = systemProblem; 151 149 return; … … 185 183 186 184 // translate the document number 187 if (!translate( gdbmptr, *docorder_here, trans_OID))185 if (!translate(db_ptr, *docorder_here, trans_OID)) 188 186 { 189 187 logout << text_t2ascii … … 261 259 } 262 260 263 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open261 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 264 262 response.numDocs = queryresults.docs_matched; 265 263 response.isApprox = queryresults.is_approx; … … 319 317 } 320 318 321 // lucenesearchptr and gdbmptr are assumed to be valid319 // lucenesearchptr and db_ptr are assumed to be valid 322 320 void lucenequeryfilterclass::do_multi_query (const FilterRequest_t &request, 323 321 const vector<queryparamclass> &query_params, -
gsdl/trunk/src/colservr/lucenequeryfilter.h
r8027 r15558 38 38 bool full_text_browse (int filterRequestOptions); 39 39 40 // mgsearchptr and gdbmptr are assumed to be valid40 // mgsearchptr and db_ptr are assumed to be valid 41 41 void do_multi_query (const FilterRequest_t &request, 42 42 const vector<queryparamclass> &query_params, -
gsdl/trunk/src/colservr/mgppqueryfilter.cpp
r13780 r15558 132 132 response.clear (); 133 133 err = noError; 134 if ( gdbmptr == NULL) {134 if (db_ptr == NULL) { 135 135 // most likely a configuration problem 136 136 logout << text_t2ascii 137 << "configuration error: queryfilter contains a null gdbmclass\n\n";137 << "configuration error: queryfilter contains a null dbclass\n\n"; 138 138 err = configurationError; 139 139 return; … … 151 151 } 152 152 // open the database 153 gdbmptr->setlogout(&logout); 154 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 155 // most likely a system problem (we have already checked that the 156 // gdbm database exists) 153 db_ptr->setlogout(&logout); 154 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 155 // most likely a system problem (we have already checked that the database exists) 157 156 logout << text_t2ascii 158 << "system problem: open on gdbm database \"" 159 << gdbm_filename << "\" failed\n\n"; 157 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 160 158 err = systemProblem; 161 159 return; … … 189 187 190 188 // translate the document number 191 if (!translate( gdbmptr, *docorder_here, trans_OID)) {189 if (!translate(db_ptr, *docorder_here, trans_OID)) { 192 190 logout << text_t2ascii 193 191 << "warning: could not translate mgpp document number \"" … … 250 248 } 251 249 252 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open250 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 253 251 response.numDocs = queryresults.docs_matched; 254 252 response.isApprox = queryresults.is_approx; … … 308 306 } 309 307 310 // mgppsearchptr and gdbmptr are assumed to be valid308 // mgppsearchptr and db_ptr are assumed to be valid 311 309 void mgppqueryfilterclass::do_multi_query (const FilterRequest_t &request, 312 310 const vector<queryparamclass> &query_params, -
gsdl/trunk/src/colservr/mgqueryfilter.cpp
r13780 r15558 170 170 docresultmap::iterator docs_end = queryresults.docs.docset.end(); 171 171 while (docs_here != docs_end) { 172 if (OID_phrase_search (*((mgsearchclass*)textsearchptr), * gdbmptr, queryparams.index,172 if (OID_phrase_search (*((mgsearchclass*)textsearchptr), *db_ptr, queryparams.index, 173 173 queryparams.subcollection, queryparams.language, 174 174 longindex, queryparams.collection, *this_phrase, … … 187 187 188 188 // do query that might involve multiple sub queries 189 // mgsearchptr and gdbmptr are assumed to be valid189 // mgsearchptr and db_ptr are assumed to be valid 190 190 void mgqueryfilterclass::do_multi_query (const FilterRequest_t &request, 191 191 const vector<queryparamclass> &query_params, … … 297 297 response.clear (); 298 298 err = noError; 299 if ( gdbmptr == NULL) {299 if (db_ptr == NULL) { 300 300 // most likely a configuration problem 301 301 logout << text_t2ascii 302 << "configuration error: mgqueryfilter contains a null gdbmclass\n\n";302 << "configuration error: mgqueryfilter contains a null dbclass\n\n"; 303 303 err = configurationError; 304 304 return; … … 313 313 314 314 // open the database 315 gdbmptr->setlogout(&logout); 316 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 317 // most likely a system problem (we have already checked that the 318 // gdbm database exists) 315 db_ptr->setlogout(&logout); 316 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 317 // most likely a system problem (we have already checked that the database exists) 319 318 logout << text_t2ascii 320 << "system problem: open on gdbm database \"" 321 << gdbm_filename << "\" failed\n\n"; 319 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 322 320 err = systemProblem; 323 321 return; … … 383 381 384 382 // translate the document number 385 if (!translate( gdbmptr, *docorder_here, trans_OID)) {383 if (!translate(db_ptr, *docorder_here, trans_OID)) { 386 384 logout << text_t2ascii 387 385 << "warning: could not translate mg document number \"" … … 445 443 } 446 444 447 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open445 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 448 446 response.numDocs = queryresults.docs_matched; 449 447 response.isApprox = queryresults.is_approx; -
gsdl/trunk/src/colservr/phrasequeryfilter.cpp
r9620 r15558 47 47 while (docs_here != docs_end) { 48 48 if ((*docs_here).second.num_query_terms_matched == queryresults.orgterms.size() && 49 OID_phrase_search (*(mgsearchclass *)textsearchptr, * gdbmptr, queryparams.index,49 OID_phrase_search (*(mgsearchclass *)textsearchptr, *db_ptr, queryparams.index, 50 50 queryparams.subcollection, queryparams.language, 51 51 longindex, queryparams.collection, queryresults.orgterms, -
gsdl/trunk/src/colservr/phrasesearch.cpp
r9631 r15558 78 78 } 79 79 80 static void get_all_docnums ( gdbmclass &gdbm, text_t OID, vector<int> &docnum_list) {80 static void get_all_docnums (dbclass &db, text_t OID, vector<int> &docnum_list) { 81 81 82 82 infodbclass OID_info; 83 83 84 84 // get OID 85 if (! gdbm.getinfo (OID, OID_info)) return;85 if (!db.getinfo (OID, OID_info)) return; 86 86 if (OID_info["hastxt"] == "1" && !OID_info["docnum"].empty()) { 87 87 docnum_list.push_back (OID_info["docnum"].getint()); … … 106 106 text_tarray::const_iterator end = contains.end(); 107 107 while (here != end) { 108 get_all_docnums ( gdbm, *here, docnum_list);108 get_all_docnums (db, *here, docnum_list); 109 109 ++here; 110 110 } … … 162 162 // an OID. This function has not been coded with all situations in mind 163 163 bool OID_phrase_search (mgsearchclass &mgsearch, 164 gdbmclass &gdbm,164 dbclass &db, 165 165 const text_t &index, 166 166 const text_t &subcollection, … … 173 173 // get OID 174 174 infodbclass docnum_info; 175 if (! gdbm.getinfo (docnum, docnum_info)) return false;175 if (!db.getinfo (docnum, docnum_info)) return false; 176 176 text_t &OID = docnum_info["section"]; 177 177 if (OID.empty()) return false; … … 201 201 // -- this is going to make a slow process even slower 202 202 vector<int> docnum_list; text_t fulldoc; 203 get_all_docnums ( gdbm, OID, docnum_list);203 get_all_docnums (db, OID, docnum_list); 204 204 vector<int>::const_iterator this_docnum = docnum_list.begin(); 205 205 vector<int>::const_iterator end_docnum = docnum_list.end(); … … 230 230 231 231 // get field 232 if (! gdbm.getinfo (OID, OID_info)) return false;232 if (!db.getinfo (OID, OID_info)) return false; 233 233 234 234 bool result = false; -
gsdl/trunk/src/colservr/phrasesearch.h
r15430 r15558 32 32 #include "unitool.h" 33 33 #include "mgsearch.h" 34 #include " gdbmclass.h"34 #include "dbclass.h" 35 35 36 36 … … 39 39 // situations in mind and expects mgsearch and gdbm set up ready to go 40 40 bool OID_phrase_search (mgsearchclass &mgsearch, 41 gdbmclass &gdbm,41 dbclass &db, 42 42 const text_t &index, 43 43 const text_t &subcollection, -
gsdl/trunk/src/colservr/queryfilter.cpp
r12871 r15558 31 31 32 32 // translate will return true if successful 33 bool queryfilterclass::translate ( gdbmclass *gdbmptr, int docnum, text_t &trans_OID) {33 bool queryfilterclass::translate (dbclass *db_ptr, int docnum, text_t &trans_OID) { 34 34 infodbclass info; 35 35 … … 37 37 38 38 // get the info 39 if ( gdbmptr == NULL) return false;40 if (! gdbmptr->getinfo(docnum, info)) return false;39 if (db_ptr == NULL) return false; 40 if (!db_ptr->getinfo(docnum, info)) return false; 41 41 42 42 // translate … … 187 187 188 188 queryfilterclass::queryfilterclass () { 189 gdbmptr = NULL;189 db_ptr = NULL; 190 190 textsearchptr = NULL; 191 191 maxnumeric = 4; … … 326 326 327 327 queryfilterclass::~queryfilterclass () { 328 // don't delete gdbmptr or mgsearchptr here, they'll328 // don't delete db_ptr or mgsearchptr here, they'll 329 329 // be cleaned up by mggdbmsource 330 330 } … … 409 409 indexstem = collection; 410 410 } 411 gdbm_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem);412 413 if (littleEndian()) gdbm_filename += ".ldb";414 else gdbm_filename += ".bdb";415 416 if (!file_exists( gdbm_filename)) {411 db_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem); 412 413 if (littleEndian()) db_filename += ".ldb"; 414 else db_filename += ".bdb"; 415 416 if (!file_exists(db_filename)) { 417 417 logout << text_t2ascii 418 << "warning: gdbm database \"" //**** 419 << gdbm_filename << "\" does not exist\n\n"; 420 //return false; //**** 418 << "warning: database \"" << db_filename << "\" does not exist\n\n"; 419 //return false; 421 420 } 422 421 -
gsdl/trunk/src/colservr/queryfilter.h
r15430 r15558 35 35 #include "comtypes.h" 36 36 #include "filter.h" 37 #include " gdbmclass.h"37 #include "dbclass.h" 38 38 #include "maptools.h" 39 39 #include "search.h" … … 48 48 stringmap languagemap; 49 49 50 text_t gdbm_filename;50 text_t db_filename; 51 51 text_t indexstem; 52 gdbmclass *gdbmptr;52 dbclass *db_ptr; 53 53 54 54 searchclass *textsearchptr; … … 63 63 64 64 // do query that might involve multiple sub queries 65 // textsearchptr and gdbmptr are assumed to be valid65 // textsearchptr and db_ptr are assumed to be valid 66 66 virtual void do_multi_query (const FilterRequest_t &request, 67 67 const vector<queryparamclass> &query_params, … … 73 73 virtual ~queryfilterclass (); 74 74 75 // the gdbmptr remains the responsability of the calling code76 void set_ gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}75 // the db_ptr remains the responsibility of the calling code 76 void set_db_ptr (dbclass *db_ptr_arg) { db_ptr = db_ptr_arg; } 77 77 78 78 // the testsearchptr remains the responsability of the calling code … … 83 83 84 84 text_t get_filter_name () {return "QueryFilter";} 85 bool translate( gdbmclass *gdbmptr, int docnum, text_t &trans_OID);85 bool translate(dbclass *db_ptr, int docnum, text_t &trans_OID); 86 86 bool need_matching_docs (int filterResultOptions); 87 87 bool need_term_info (int filterResultOptions);
Note:
See TracChangeset
for help on using the changeset viewer.