Changeset 9346
- Timestamp:
- 2005-03-10T10:00:00+13:00 (19 years ago)
- Location:
- trunk/gsdl/src/colservr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/lucenegdbmsource.cpp
r9190 r9346 25 25 26 26 #include "lucenegdbmsource.h" 27 #include "fileutil.h"28 #include "OIDtools.h"29 #include "gsdltools.h"30 #include "expat_document.h"31 #include "lucenesearch.h"32 27 33 34 lucenegdbmsourceclass::lucenegdbmsourceclass () { 35 gdbmptr = NULL; 36 textsearchptr = NULL;28 lucenegdbmsourceclass::lucenegdbmsourceclass () 29 : gdbmsourceclass() 30 { 31 classname = "lucenegdbmsource"; 37 32 } 38 33 39 34 lucenegdbmsourceclass::~lucenegdbmsourceclass () { 40 if (gdbmptr != NULL) delete gdbmptr;41 if (textsearchptr != NULL) delete textsearchptr;42 35 } 43 36 44 void lucenegdbmsourceclass::configure (const text_t &key, const text_tarray &cfgline) {45 if (cfgline.size() >= 1) {46 const text_t &value = cfgline[0];47 48 if (key == "collection") collection = value;49 else if (key == "collectdir") collectdir = value;50 else if (key == "gsdlhome") gsdlhome = value;51 else if (key == "gdbmhome") gdbmhome = value;52 }53 54 if (key == "indexmap") {55 indexmap.importmap (cfgline);56 57 } else if (key == "defaultindex") {58 indexmap.from2to (cfgline[0], defaultindex);59 60 } else if (key == "subcollectionmap") {61 subcollectionmap.importmap (cfgline);62 63 } else if (key == "defaultsubcollection") {64 subcollectionmap.from2to (cfgline[0], defaultsubcollection);65 66 } else if (key == "languagemap") {67 languagemap.importmap (cfgline);68 69 } else if (key == "defaultlanguage")70 languagemap.from2to (cfgline[0], defaultlanguage);71 }72 73 bool lucenegdbmsourceclass::init (ostream &logout) {74 outconvertclass text_t2ascii;75 76 if (gdbmhome.empty()) gdbmhome = gsdlhome;77 78 if (!sourceclass::init (logout)) return false;79 80 if (defaultindex.empty()) {81 // use first index in map as default if no default is set explicitly82 text_tarray toarray;83 indexmap.gettoarray(toarray);84 if (toarray.size()) {85 defaultindex = toarray[0];86 }87 }88 89 if (defaultsubcollection.empty()) {90 // use first subcollection in map as default if no default is set explicitly91 text_tarray toarray;92 subcollectionmap.gettoarray(toarray);93 if (toarray.size()) {94 defaultsubcollection = toarray[0];95 }96 }97 98 if (defaultlanguage.empty()) {99 // use first language in map as default if no default is set explicitly100 text_tarray toarray;101 languagemap.gettoarray(toarray);102 if (toarray.size()) {103 defaultlanguage = toarray[0];104 }105 }106 107 // get the collection directory name108 if (collectdir.empty()) {109 collectdir = filename_cat (gsdlhome, "collect", collection);110 }111 112 // get the filename for the database and make sure it exists113 gdbm_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", collection);114 if (littleEndian()) gdbm_filename += ".ldb";115 else gdbm_filename += ".bdb";116 117 if (!file_exists(gdbm_filename)) {118 logout << text_t2ascii119 << "warning: **** gdbm database \"" //****120 << gdbm_filename << "\" does not exist\n\n";121 // return false; //****122 }123 124 return true;125 }126 127 bool lucenegdbmsourceclass::translate_OID (const text_t &OIDin, text_t &OIDout,128 comerror_t &err, ostream &logout) {129 130 outconvertclass text_t2ascii;131 132 err = noError;133 if (gdbmptr == NULL) {134 // most likely a configuration problem135 logout << text_t2ascii136 << "configuration error: lucenegdbmsource contains a null gdbmclass\n\n";137 err = configurationError;138 return true;139 }140 141 // open the database142 gdbmptr->setlogout(&logout);143 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) {144 // most likely a system problem (we have already checked that the145 // gdbm database exists)146 logout << text_t2ascii147 << "system problem: open on gdbm database \""148 << gdbm_filename << "\" failed\n\n";149 err = systemProblem;150 return true;151 }152 153 infodbclass info;154 OIDout = gdbmptr->translate_OID (OIDin, info);155 return true;156 }157 158 bool lucenegdbmsourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,159 bool getParents, const text_tset &fields,160 const text_t &OID, MetadataInfo_tmap &metadata,161 comerror_t &err, ostream &logout) {162 outconvertclass text_t2ascii;163 164 metadata.erase(metadata.begin(), metadata.end());165 166 err = noError;167 if (gdbmptr == NULL) {168 // most likely a configuration problem169 logout << text_t2ascii170 << "configuration error: lucenegdbmsource contains a null gdbmclass\n\n";171 err = configurationError;172 return true;173 }174 175 // open the database176 gdbmptr->setlogout(&logout);177 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) {178 // most likely a system problem (we have already checked that the179 // gdbm database exists)180 logout << text_t2ascii181 << "system problem: open on gdbm database \""182 << gdbm_filename << "\" failed\n\n";183 err = systemProblem;184 return true;185 }186 187 // get the metadata - if getParents is set we need to get188 // info for all parents of OID as well as OID189 vector<infodbclass> info_array;190 text_tarray OIDs;191 if (getParents) get_parents_array (OID, OIDs);192 OIDs.push_back (OID);193 194 text_tarray::const_iterator this_OID = OIDs.begin();195 text_tarray::const_iterator end_OID = OIDs.end();196 197 while (this_OID != end_OID) {198 infodbclass info;199 if (!gdbmptr->getinfo(*this_OID, info)) return false;200 201 // adjust the metadata202 text_t &contains = info["contains"];203 if (contains.empty()) info["haschildren"] = 0;204 else info["haschildren"] = 1;205 contains.clear();206 207 info_array.push_back(info);208 this_OID ++;209 }210 211 // if fields set is empty we want to get all available metadata212 text_tset tfields = fields;213 if (tfields.empty() && !info_array.empty()) {214 infodbclass::iterator t_info = info_array[0].begin();215 infodbclass::iterator e_info = info_array[0].end();216 while (t_info != e_info) {217 if ((*t_info).first != "contains")218 tfields.insert ((*t_info).first);219 t_info ++;220 }221 tfields.insert ("hasnext");222 tfields.insert ("hasprevious");223 }224 225 // collect together the metadata226 bool donenextprevtest = false;227 bool hasnext=false, hasprevious=false;228 MetadataInfo_t this_metadata;229 text_tarray *pos_metadata;230 text_tset::const_iterator fields_here = tfields.begin();231 text_tset::const_iterator fields_end = tfields.end();232 233 while (fields_here != fields_end) {234 this_metadata.clear();235 this_metadata.isRef = false;236 237 vector<infodbclass>::reverse_iterator this_info = info_array.rbegin();238 vector<infodbclass>::reverse_iterator end_info = info_array.rend();239 MetadataInfo_t *tmetaptr = &this_metadata;240 while (this_info != end_info) {241 242 pos_metadata = (*this_info).getmultinfo(*fields_here);243 if ((*fields_here == "hasnext" || *fields_here == "hasprevious")) {244 245 // collect metadata246 if (!donenextprevtest) {247 donenextprevtest = true;248 249 // cache parent contents array250 text_t thisparent = get_parent (OID);251 if (!thisparent.empty()) {252 if (thisparent != parentOID) {253 parentOID = thisparent;254 parentcontents.erase(parentcontents.begin(), parentcontents.end());255 if (gdbmptr->getinfo(parentOID, parentinfo)) {256 text_t &parentinfocontains = parentinfo["contains"];257 if (!parentinfocontains.empty())258 splitchar (parentinfocontains.begin(), parentinfocontains.end(),259 ';', parentcontents);260 }261 }262 263 // do tests264 text_tarray::const_iterator parentcontents_here = parentcontents.begin();265 text_tarray::const_iterator parentcontents_end = parentcontents.end();266 text_t shrunk_OID = OID;267 shrink_parent (shrunk_OID);268 while (parentcontents_here != parentcontents_end) {269 if (*parentcontents_here == shrunk_OID) {270 if (parentcontents_here == parentcontents.begin()) hasprevious = false;271 else hasprevious = true;272 273 parentcontents_here++;274 275 if (parentcontents_here == parentcontents.end()) hasnext = false;276 else hasnext = true;277 278 break;279 }280 281 parentcontents_here ++;282 }283 284 // fill in metadata285 if ((*fields_here == "hasnext" && hasnext) ||286 (*fields_here == "hasprevious" && hasprevious))287 tmetaptr->values.push_back("1");288 else289 tmetaptr->values.push_back("0");290 } else291 tmetaptr->values.push_back("0");292 }293 }294 else if (pos_metadata != NULL && *fields_here != "contains") {295 tmetaptr->values = *pos_metadata;296 }297 else298 tmetaptr->values.push_back("");299 300 this_info ++;301 if (this_info != end_info) {302 tmetaptr->parent = new MetadataInfo_t();303 tmetaptr = tmetaptr->parent;304 }305 }306 metadata[*fields_here] = this_metadata;307 fields_here++;308 }309 return true;310 }311 312 313 bool lucenegdbmsourceclass::get_document (const text_t &OID, text_t &doc,314 comerror_t &err, ostream &logout) {315 316 outconvertclass text_t2ascii;317 err = noError;318 if (gdbmptr == NULL) {319 // most likely a configuration problem320 logout << text_t2ascii321 << "configuration error: lucenegdbmsource contains a null gdbmclass\n\n";322 err = configurationError;323 return true;324 }325 326 // open the database327 gdbmptr->setlogout(&logout);328 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) {329 // most likely a system problem (we have already checked that the330 // gdbm database exists)331 logout << text_t2ascii332 << "system problem: open on gdbm database \""333 << gdbm_filename << "\" failed\n\n";334 err = systemProblem;335 return true;336 }337 338 text_t tOID = OID;339 if (needs_translating (OID))340 translate_OID (OID, tOID, err, logout);341 infodbclass info;342 if (!gdbmptr->getinfo(tOID, info)) return false;343 344 if (info["hastxt"].getint() == 0) { // there is no text for this section345 return false; // true??346 }347 int docnum = info["docnum"].getint();348 349 // get the parent id350 text_t parent_OID;351 get_top(tOID, parent_OID);352 353 // locate the parent info ingdbm db354 if (!gdbmptr->getinfo(parent_OID, info)) return false;355 356 text_t archive_dir = info["assocfilepath"];357 text_t full_path_to_doc = filename_cat(collectdir, "index", "text", archive_dir, "doc.xml");358 359 doc.clear();360 expat_document(full_path_to_doc, ((lucenesearchclass*)textsearchptr)->gdbm_level, text_t(docnum), doc);361 return true;362 }363 364 bool lucenegdbmsourceclass::is_searchable(bool &issearchable, comerror_t &err, ostream &logout) {365 err = noError;366 issearchable = false;367 368 text_tarray fromarray;369 indexmap.getfromarray(fromarray);370 if (fromarray.size() == 0) {371 return true;372 } else if (fromarray.size() == 1) {373 if (fromarray[0] == "dummy:text") {374 // always return true - issearchable is false here though375 return true;376 }377 }378 issearchable = true;379 return true;380 } -
trunk/gsdl/src/colservr/lucenegdbmsource.h
r8027 r9346 34 34 #include "maptools.h" 35 35 #include "search.h" 36 #include " source.h"36 #include "gdbmsource.h" 37 37 38 38 39 class lucenegdbmsourceclass : public sourceclass { 40 protected: 41 text_t gsdlhome; 42 text_t gdbmhome; 43 text_t collection; 44 text_t collectdir; 45 46 // these maps are only needed to convert the default indexes 47 stringmap indexmap; 48 stringmap subcollectionmap; 49 stringmap languagemap; 50 51 text_t defaultindex; 52 text_t defaultsubcollection; 53 text_t defaultlanguage; 54 55 text_t parentOID; 56 infodbclass parentinfo; 57 text_tarray parentcontents; 58 59 text_t gdbm_filename; 60 gdbmclass *gdbmptr; 61 62 searchclass *textsearchptr; 63 39 class lucenegdbmsourceclass : public gdbmsourceclass { 64 40 public: 65 41 lucenegdbmsourceclass (); 66 42 virtual ~lucenegdbmsourceclass (); 67 43 68 // the gdbmptr remains the responsability of the calling code69 void set_gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}70 71 // the textsearchptr remains the responsability of the calling code72 void set_textsearchptr (searchclass *thetextsearchptr) {textsearchptr=thetextsearchptr;}73 74 void configure (const text_t &key, const text_tarray &cfgline);75 bool init (ostream &logout);76 bool translate_OID (const text_t &OIDin, text_t &OIDout,77 comerror_t &err, ostream &logout);78 bool get_metadata (const text_t &requestParams, const text_t &refParams,79 bool getParents, const text_tset &fields,80 const text_t &OID, MetadataInfo_tmap &metadata,81 comerror_t &err, ostream &logout);82 bool get_document (const text_t &OID, text_t &doc,83 comerror_t &err, ostream &logout);84 bool is_searchable(bool &issearchable, comerror_t &err, ostream &logout);85 44 }; 86 45 -
trunk/gsdl/src/colservr/mggdbmsource.cpp
r8025 r9346 25 25 26 26 #include "mggdbmsource.h" 27 #include "fileutil.h"28 #include "OIDtools.h"29 #include "gsdltools.h"30 27 31 32 mggdbmsourceclass::mggdbmsourceclass () { 33 gdbmptr = NULL; 34 textsearchptr = NULL;28 mggdbmsourceclass::mggdbmsourceclass () 29 : gdbmsourceclass() 30 { 31 classname = "mggdbsource"; 35 32 } 36 33 37 mggdbmsourceclass::~mggdbmsourceclass () { 38 if (gdbmptr != NULL) delete gdbmptr; 39 if (textsearchptr != NULL) delete textsearchptr; 34 mggdbmsourceclass::~mggdbmsourceclass () 35 { 40 36 } 41 37 42 void mggdbmsourceclass::configure (const text_t &key, const text_tarray &cfgline) {43 if (cfgline.size() >= 1) {44 const text_t &value = cfgline[0];45 46 if (key == "collection") collection = value;47 else if (key == "collectdir") collectdir = value;48 else if (key == "gsdlhome") gsdlhome = value;49 else if (key == "gdbmhome") gdbmhome = value;50 }51 52 if (key == "indexmap") {53 indexmap.importmap (cfgline);54 55 } else if (key == "defaultindex") {56 indexmap.from2to (cfgline[0], defaultindex);57 58 } else if (key == "subcollectionmap") {59 subcollectionmap.importmap (cfgline);60 61 } else if (key == "defaultsubcollection") {62 subcollectionmap.from2to (cfgline[0], defaultsubcollection);63 64 } else if (key == "languagemap") {65 languagemap.importmap (cfgline);66 67 } else if (key == "defaultlanguage")68 languagemap.from2to (cfgline[0], defaultlanguage);69 }70 71 bool mggdbmsourceclass::init (ostream &logout) {72 outconvertclass text_t2ascii;73 74 if (gdbmhome.empty()) gdbmhome = gsdlhome;75 76 if (!sourceclass::init (logout)) return false;77 78 if (defaultindex.empty()) {79 // use first index in map as default if no default is set explicitly80 text_tarray toarray;81 indexmap.gettoarray(toarray);82 if (toarray.size()) {83 defaultindex = toarray[0];84 }85 }86 87 if (defaultsubcollection.empty()) {88 // use first subcollection in map as default if no default is set explicitly89 text_tarray toarray;90 subcollectionmap.gettoarray(toarray);91 if (toarray.size()) {92 defaultsubcollection = toarray[0];93 }94 }95 96 if (defaultlanguage.empty()) {97 // use first language in map as default if no default is set explicitly98 text_tarray toarray;99 languagemap.gettoarray(toarray);100 if (toarray.size()) {101 defaultlanguage = toarray[0];102 }103 }104 105 // get the collection directory name106 if (collectdir.empty()) {107 collectdir = filename_cat (gsdlhome, "collect", collection);108 }109 110 // get the filename for the database and make sure it exists111 gdbm_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", collection);112 if (littleEndian()) gdbm_filename += ".ldb";113 else gdbm_filename += ".bdb";114 115 if (!file_exists(gdbm_filename)) {116 logout << text_t2ascii117 << "warning: gdbm database \"" //****118 << gdbm_filename << "\" does not exist\n\n";119 // return false; //****120 }121 122 return true;123 }124 125 bool mggdbmsourceclass::translate_OID (const text_t &OIDin, text_t &OIDout,126 comerror_t &err, ostream &logout) {127 128 outconvertclass text_t2ascii;129 130 err = noError;131 if (gdbmptr == NULL) {132 // most likely a configuration problem133 logout << text_t2ascii134 << "configuration error: mggdbmsource contains a null gdbmclass\n\n";135 err = configurationError;136 return true;137 }138 139 // open the database140 gdbmptr->setlogout(&logout);141 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) {142 // most likely a system problem (we have already checked that the143 // gdbm database exists)144 logout << text_t2ascii145 << "system problem: open on gdbm database \""146 << gdbm_filename << "\" failed\n\n";147 err = systemProblem;148 return true;149 }150 151 infodbclass info;152 OIDout = gdbmptr->translate_OID (OIDin, info);153 return true;154 }155 156 bool mggdbmsourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,157 bool getParents, const text_tset &fields,158 const text_t &OID, MetadataInfo_tmap &metadata,159 comerror_t &err, ostream &logout) {160 outconvertclass text_t2ascii;161 162 metadata.erase(metadata.begin(), metadata.end());163 164 err = noError;165 if (gdbmptr == NULL) {166 // most likely a configuration problem167 logout << text_t2ascii168 << "configuration error: mggdbmsource contains a null gdbmclass\n\n";169 err = configurationError;170 return true;171 }172 173 // open the database174 gdbmptr->setlogout(&logout);175 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) {176 // most likely a system problem (we have already checked that the177 // gdbm database exists)178 logout << text_t2ascii179 << "system problem: open on gdbm database \""180 << gdbm_filename << "\" failed\n\n";181 err = systemProblem;182 return true;183 }184 185 // get the metadata - if getParents is set we need to get186 // info for all parents of OID as well as OID187 vector<infodbclass> info_array;188 text_tarray OIDs;189 if (getParents) get_parents_array (OID, OIDs);190 OIDs.push_back (OID);191 192 text_tarray::const_iterator this_OID = OIDs.begin();193 text_tarray::const_iterator end_OID = OIDs.end();194 195 while (this_OID != end_OID) {196 infodbclass info;197 if (!gdbmptr->getinfo(*this_OID, info)) return false;198 199 // adjust the metadata200 text_t &contains = info["contains"];201 if (contains.empty()) info["haschildren"] = 0;202 else info["haschildren"] = 1;203 contains.clear();204 205 info_array.push_back(info);206 this_OID ++;207 }208 209 // if fields set is empty we want to get all available metadata210 text_tset tfields = fields;211 if (tfields.empty() && !info_array.empty()) {212 infodbclass::iterator t_info = info_array[0].begin();213 infodbclass::iterator e_info = info_array[0].end();214 while (t_info != e_info) {215 if ((*t_info).first != "contains")216 tfields.insert ((*t_info).first);217 t_info ++;218 }219 tfields.insert ("hasnext");220 tfields.insert ("hasprevious");221 }222 223 // collect together the metadata224 bool donenextprevtest = false;225 bool hasnext=false, hasprevious=false;226 MetadataInfo_t this_metadata;227 text_tarray *pos_metadata;228 text_tset::const_iterator fields_here = tfields.begin();229 text_tset::const_iterator fields_end = tfields.end();230 231 while (fields_here != fields_end) {232 this_metadata.clear();233 this_metadata.isRef = false;234 235 vector<infodbclass>::reverse_iterator this_info = info_array.rbegin();236 vector<infodbclass>::reverse_iterator end_info = info_array.rend();237 MetadataInfo_t *tmetaptr = &this_metadata;238 while (this_info != end_info) {239 240 pos_metadata = (*this_info).getmultinfo(*fields_here);241 if ((*fields_here == "hasnext" || *fields_here == "hasprevious")) {242 243 // collect metadata244 if (!donenextprevtest) {245 donenextprevtest = true;246 247 // cache parent contents array248 text_t thisparent = get_parent (OID);249 if (!thisparent.empty()) {250 if (thisparent != parentOID) {251 parentOID = thisparent;252 parentcontents.erase(parentcontents.begin(), parentcontents.end());253 if (gdbmptr->getinfo(parentOID, parentinfo)) {254 text_t &parentinfocontains = parentinfo["contains"];255 if (!parentinfocontains.empty())256 splitchar (parentinfocontains.begin(), parentinfocontains.end(),257 ';', parentcontents);258 }259 }260 261 // do tests262 text_tarray::const_iterator parentcontents_here = parentcontents.begin();263 text_tarray::const_iterator parentcontents_end = parentcontents.end();264 text_t shrunk_OID = OID;265 shrink_parent (shrunk_OID);266 while (parentcontents_here != parentcontents_end) {267 if (*parentcontents_here == shrunk_OID) {268 if (parentcontents_here == parentcontents.begin()) hasprevious = false;269 else hasprevious = true;270 271 parentcontents_here++;272 273 if (parentcontents_here == parentcontents.end()) hasnext = false;274 else hasnext = true;275 276 break;277 }278 279 parentcontents_here ++;280 }281 282 // fill in metadata283 if ((*fields_here == "hasnext" && hasnext) ||284 (*fields_here == "hasprevious" && hasprevious))285 tmetaptr->values.push_back("1");286 else287 tmetaptr->values.push_back("0");288 } else289 tmetaptr->values.push_back("0");290 }291 }292 else if (pos_metadata != NULL && *fields_here != "contains") {293 tmetaptr->values = *pos_metadata;294 }295 else296 tmetaptr->values.push_back("");297 298 this_info ++;299 if (this_info != end_info) {300 tmetaptr->parent = new MetadataInfo_t();301 tmetaptr = tmetaptr->parent;302 }303 }304 metadata[*fields_here] = this_metadata;305 fields_here++;306 }307 return true;308 }309 310 311 bool mggdbmsourceclass::get_document (const text_t &OID, text_t &doc,312 comerror_t &err, ostream &logout) {313 314 outconvertclass text_t2ascii;315 316 err = noError;317 if (gdbmptr == NULL) {318 // most likely a configuration problem319 logout << text_t2ascii320 << "configuration error: mggdbmsource contains a null gdbmclass\n\n";321 err = configurationError;322 return true;323 }324 325 // open the database326 gdbmptr->setlogout(&logout);327 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) {328 // most likely a system problem (we have already checked that the329 // gdbm database exists)330 logout << text_t2ascii331 << "system problem: open on gdbm database \""332 << gdbm_filename << "\" failed\n\n";333 err = systemProblem;334 return true;335 }336 337 text_t tOID = OID;338 if (needs_translating (OID))339 translate_OID (OID, tOID, err, logout);340 infodbclass info;341 if (!gdbmptr->getinfo(tOID, info)) return false;342 343 if (info["hastxt"].getint() == 1) {344 int docnum = info["docnum"].getint();345 346 // set the collection directory347 textsearchptr->setcollectdir (collectdir);348 349 // get the text350 textsearchptr->docTargetDocument(defaultindex, defaultsubcollection,351 defaultlanguage, collection, docnum, doc);352 }353 return true;354 }355 356 bool mggdbmsourceclass::is_searchable(bool &issearchable, comerror_t &err, ostream &logout) {357 err = noError;358 issearchable = false;359 360 text_tarray fromarray;361 indexmap.getfromarray(fromarray);362 if (fromarray.size() == 0) {363 return true;364 } else if (fromarray.size() == 1) {365 if (fromarray[0] == "dummy:text") {366 // always return true - issearchable is false here though367 return true;368 }369 }370 issearchable = true;371 return true;372 } -
trunk/gsdl/src/colservr/mggdbmsource.h
r8025 r9346 34 34 #include "maptools.h" 35 35 #include "search.h" 36 #include " source.h"36 #include "gdbmsource.h" 37 37 38 38 39 class mggdbmsourceclass : public sourceclass { 40 protected: 41 text_t gsdlhome; 42 text_t gdbmhome; 43 text_t collection; 44 text_t collectdir; 45 46 // these maps are only needed to convert the default indexes 47 stringmap indexmap; 48 stringmap subcollectionmap; 49 stringmap languagemap; 50 51 text_t defaultindex; 52 text_t defaultsubcollection; 53 text_t defaultlanguage; 54 55 text_t parentOID; 56 infodbclass parentinfo; 57 text_tarray parentcontents; 58 59 text_t gdbm_filename; 60 gdbmclass *gdbmptr; 61 62 searchclass *textsearchptr; 63 39 class mggdbmsourceclass : public gdbmsourceclass { 64 40 public: 65 41 mggdbmsourceclass (); 66 42 virtual ~mggdbmsourceclass (); 67 43 68 // the gdbmptr remains the responsability of the calling code69 void set_gdbmptr (gdbmclass *thegdbmptr) {gdbmptr=thegdbmptr;}70 71 // the textsearchptr remains the responsability of the calling code72 void set_textsearchptr (searchclass *thetextsearchptr) {textsearchptr=thetextsearchptr;}73 74 void configure (const text_t &key, const text_tarray &cfgline);75 bool init (ostream &logout);76 bool translate_OID (const text_t &OIDin, text_t &OIDout,77 comerror_t &err, ostream &logout);78 bool get_metadata (const text_t &requestParams, const text_t &refParams,79 bool getParents, const text_tset &fields,80 const text_t &OID, MetadataInfo_tmap &metadata,81 comerror_t &err, ostream &logout);82 bool get_document (const text_t &OID, text_t &doc,83 comerror_t &err, ostream &logout);84 bool is_searchable(bool &issearchable, comerror_t &err, ostream &logout);85 44 }; 86 45
Note:
See TracChangeset
for help on using the changeset viewer.