|
a/src/rcldb/stemdb.cpp |
|
b/src/rcldb/stemdb.cpp |
|
... |
|
... |
88 |
return true;
|
88 |
return true;
|
89 |
return false;
|
89 |
return false;
|
90 |
}
|
90 |
}
|
91 |
|
91 |
|
92 |
static bool addAssoc(Xapian::WritableDatabase &sdb, const string& stem,
|
92 |
static bool addAssoc(Xapian::WritableDatabase &sdb, const string& stem,
|
93 |
const list<string>& derivs)
|
93 |
const vector<string>& derivs)
|
94 |
{
|
94 |
{
|
95 |
Xapian::Document newdocument;
|
95 |
Xapian::Document newdocument;
|
96 |
newdocument.add_term(stem);
|
96 |
newdocument.add_term(stem);
|
97 |
// The doc data is just parents=blank-separated-list
|
97 |
// The doc data is just parents=blank-separated-list
|
98 |
string record = "parents=";
|
98 |
string record = "parents=";
|
99 |
for (list<string>::const_iterator it = derivs.begin();
|
99 |
for (vector<string>::const_iterator it = derivs.begin();
|
100 |
it != derivs.end(); it++) {
|
100 |
it != derivs.end(); it++) {
|
101 |
record += *it + " ";
|
101 |
record += *it + " ";
|
102 |
}
|
102 |
}
|
103 |
record += "\n";
|
103 |
record += "\n";
|
104 |
LOGDEB2(("createStemDb: stmdoc data: [%s]\n", record.c_str()));
|
104 |
LOGDEB2(("createStemDb: stmdoc data: [%s]\n", record.c_str()));
|
|
... |
|
... |
213 |
return false;
|
213 |
return false;
|
214 |
}
|
214 |
}
|
215 |
|
215 |
|
216 |
// Enter pseud-docs in db by walking the multimap.
|
216 |
// Enter pseud-docs in db by walking the multimap.
|
217 |
string stem;
|
217 |
string stem;
|
218 |
list<string> derivs;
|
218 |
vector<string> derivs;
|
219 |
for (multimap<string,string>::const_iterator it = assocs.begin();
|
219 |
for (multimap<string,string>::const_iterator it = assocs.begin();
|
220 |
it != assocs.end(); it++) {
|
220 |
it != assocs.end(); it++) {
|
221 |
if (stem == it->first) {
|
221 |
if (stem == it->first) {
|
222 |
// Staying with same stem
|
222 |
// Staying with same stem
|
223 |
derivs.push_back(it->second);
|
223 |
derivs.push_back(it->second);
|
|
... |
|
... |
348 |
const std::string& langs,
|
348 |
const std::string& langs,
|
349 |
const std::string& term,
|
349 |
const std::string& term,
|
350 |
vector<string>& result)
|
350 |
vector<string>& result)
|
351 |
{
|
351 |
{
|
352 |
|
352 |
|
353 |
list<string> llangs;
|
353 |
vector<string> llangs;
|
354 |
stringToStrings(langs, llangs);
|
354 |
stringToStrings(langs, llangs);
|
355 |
for (list<string>::const_iterator it = llangs.begin();
|
355 |
for (vector<string>::const_iterator it = llangs.begin();
|
356 |
it != llangs.end(); it++) {
|
356 |
it != llangs.end(); it++) {
|
357 |
vector<string> oneexp;
|
357 |
vector<string> oneexp;
|
358 |
stemExpandOne(dbdir, *it, term, oneexp);
|
358 |
stemExpandOne(dbdir, *it, term, oneexp);
|
359 |
result.insert(result.end(), oneexp.begin(), oneexp.end());
|
359 |
result.insert(result.end(), oneexp.begin(), oneexp.end());
|
360 |
}
|
360 |
}
|