|
a/src/rcldb/stemdb.cpp |
|
b/src/rcldb/stemdb.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: stemdb.cpp,v 1.11 2007-11-08 09:34:17 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: stemdb.cpp,v 1.12 2008-07-30 13:16:13 dockes Exp $ (C) 2005 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
|
4 |
|
5 |
/**
|
5 |
/**
|
6 |
* Management of the auxiliary databases listing stems and their expansion
|
6 |
* Management of the auxiliary databases listing stems and their expansion
|
7 |
* terms
|
7 |
* terms
|
|
... |
|
... |
139 |
// Create xapian database for stem relations
|
139 |
// Create xapian database for stem relations
|
140 |
string stemdbdir = stemdbname(dbdir, lang);
|
140 |
string stemdbdir = stemdbname(dbdir, lang);
|
141 |
// We want to get rid of the db dir in case of error. This gets disarmed
|
141 |
// We want to get rid of the db dir in case of error. This gets disarmed
|
142 |
// just before success return.
|
142 |
// just before success return.
|
143 |
DirWiper wiper(stemdbdir);
|
143 |
DirWiper wiper(stemdbdir);
|
144 |
const char *ermsg = "NOERROR";
|
144 |
string ermsg;
|
145 |
Xapian::WritableDatabase sdb;
|
145 |
Xapian::WritableDatabase sdb;
|
146 |
try {
|
146 |
try {
|
147 |
sdb = Xapian::WritableDatabase(stemdbdir,
|
147 |
sdb = Xapian::WritableDatabase(stemdbdir,
|
148 |
Xapian::DB_CREATE_OR_OVERWRITE);
|
148 |
Xapian::DB_CREATE_OR_OVERWRITE);
|
149 |
} catch (const Xapian::Error &e) {
|
149 |
} catch (const Xapian::Error &e) {
|
150 |
ermsg = e.get_msg().c_str();
|
150 |
ermsg = e.get_msg();
|
151 |
} catch (const string &s) {
|
151 |
} catch (const string &s) {
|
152 |
ermsg = s.c_str();
|
152 |
ermsg = s;
|
153 |
} catch (const char *s) {
|
153 |
} catch (const char *s) {
|
154 |
ermsg = s;
|
154 |
ermsg = s;
|
155 |
} catch (...) {
|
155 |
} catch (...) {
|
156 |
ermsg = "Caught unknown exception";
|
156 |
ermsg = "Caught unknown exception";
|
157 |
}
|
157 |
}
|
158 |
if (ermsg != "NOERROR") {
|
158 |
if (!ermsg.empty()) {
|
159 |
LOGERR(("Db::createstemdb: exception while opening [%s]: %s\n",
|
159 |
LOGERR(("Db::createstemdb: exception while opening [%s]: %s\n",
|
160 |
stemdbdir.c_str(), ermsg));
|
160 |
stemdbdir.c_str(), ermsg.c_str()));
|
161 |
return false;
|
161 |
return false;
|
162 |
}
|
162 |
}
|
163 |
|
163 |
|
164 |
// Enter pseud-docs in db. Walk the multimap, only enter
|
164 |
// Enter pseud-docs in db. Walk the multimap, only enter
|
165 |
// associations where there are several parent terms
|
165 |
// associations where there are several parent terms
|