|
a/src/rcldb/synfamily.cpp |
|
b/src/rcldb/synfamily.cpp |
|
... |
|
... |
18 |
|
18 |
|
19 |
#include "autoconfig.h"
|
19 |
#include "autoconfig.h"
|
20 |
|
20 |
|
21 |
#include <iostream>
|
21 |
#include <iostream>
|
22 |
#include <algorithm>
|
22 |
#include <algorithm>
|
|
|
23 |
#include MEMORY_INCLUDE
|
23 |
|
24 |
|
24 |
#include "debuglog.h"
|
25 |
#include "debuglog.h"
|
25 |
#include "cstr.h"
|
26 |
#include "cstr.h"
|
26 |
#include "xmacros.h"
|
27 |
#include "xmacros.h"
|
27 |
#include "synfamily.h"
|
28 |
#include "synfamily.h"
|
28 |
#include "smallut.h"
|
29 |
#include "smallut.h"
|
29 |
#include "refcntr.h"
|
|
|
30 |
|
30 |
|
31 |
using namespace std;
|
31 |
using namespace std;
|
32 |
|
32 |
|
33 |
namespace Rcl {
|
33 |
namespace Rcl {
|
34 |
|
34 |
|
|
... |
|
... |
186 |
SynTermTrans *filtertrans)
|
186 |
SynTermTrans *filtertrans)
|
187 |
{
|
187 |
{
|
188 |
LOGDEB(("XapCompSynFam::synKeyExpand: [%s]\n", inexp->exp().c_str()));
|
188 |
LOGDEB(("XapCompSynFam::synKeyExpand: [%s]\n", inexp->exp().c_str()));
|
189 |
|
189 |
|
190 |
// If set, compute filtering term (e.g.: only case-folded)
|
190 |
// If set, compute filtering term (e.g.: only case-folded)
|
191 |
RefCntr<StrMatcher> filter_exp;
|
191 |
STD_SHARED_PTR<StrMatcher> filter_exp;
|
192 |
if (filtertrans) {
|
192 |
if (filtertrans) {
|
193 |
filter_exp = RefCntr<StrMatcher>(inexp->clone());
|
193 |
filter_exp = STD_SHARED_PTR<StrMatcher>(inexp->clone());
|
194 |
filter_exp->setExp((*filtertrans)(inexp->exp()));
|
194 |
filter_exp->setExp((*filtertrans)(inexp->exp()));
|
195 |
}
|
195 |
}
|
196 |
|
196 |
|
197 |
// Transform input into our key format (e.g.: case-folded + diac-stripped),
|
197 |
// Transform input into our key format (e.g.: case-folded + diac-stripped),
|
198 |
// and prepend prefix
|
198 |
// and prepend prefix
|
|
... |
|
... |
215 |
// Push all the synonyms if they match the secondary filter
|
215 |
// Push all the synonyms if they match the secondary filter
|
216 |
for (Xapian::TermIterator xit1 =
|
216 |
for (Xapian::TermIterator xit1 =
|
217 |
m_family.getdb().synonyms_begin(*xit);
|
217 |
m_family.getdb().synonyms_begin(*xit);
|
218 |
xit1 != m_family.getdb().synonyms_end(*xit); xit1++) {
|
218 |
xit1 != m_family.getdb().synonyms_end(*xit); xit1++) {
|
219 |
string term = *xit1;
|
219 |
string term = *xit1;
|
220 |
if (filter_exp.isNotNull()) {
|
220 |
if (filter_exp) {
|
221 |
string term1 = (*filtertrans)(term);
|
221 |
string term1 = (*filtertrans)(term);
|
222 |
LOGDEB2((" Testing [%s] against [%s]\n",
|
222 |
LOGDEB2((" Testing [%s] against [%s]\n",
|
223 |
term1.c_str(), filter_exp->exp().c_str()));
|
223 |
term1.c_str(), filter_exp->exp().c_str()));
|
224 |
if (!filter_exp->match(term1)) {
|
224 |
if (!filter_exp->match(term1)) {
|
225 |
continue;
|
225 |
continue;
|
|
... |
|
... |
229 |
(*xit1).c_str()));
|
229 |
(*xit1).c_str()));
|
230 |
result.push_back(*xit1);
|
230 |
result.push_back(*xit1);
|
231 |
}
|
231 |
}
|
232 |
// Same with key itself
|
232 |
// Same with key itself
|
233 |
string term = (*xit).substr(preflen);
|
233 |
string term = (*xit).substr(preflen);
|
234 |
if (filter_exp.isNotNull()) {
|
234 |
if (filter_exp) {
|
235 |
string term1 = (*filtertrans)(term);
|
235 |
string term1 = (*filtertrans)(term);
|
236 |
LOGDEB2((" Testing [%s] against [%s]\n",
|
236 |
LOGDEB2((" Testing [%s] against [%s]\n",
|
237 |
term1.c_str(), filter_exp->exp().c_str()));
|
237 |
term1.c_str(), filter_exp->exp().c_str()));
|
238 |
if (!filter_exp->match(term1)) {
|
238 |
if (!filter_exp->match(term1)) {
|
239 |
continue;
|
239 |
continue;
|