|
a/src/rcldb/rclabstract.cpp |
|
b/src/rcldb/rclabstract.cpp |
|
... |
|
... |
68 |
out.push_back(strip_prefix(*qit));
|
68 |
out.push_back(strip_prefix(*qit));
|
69 |
}
|
69 |
}
|
70 |
sort(out.begin(), out.end());
|
70 |
sort(out.begin(), out.end());
|
71 |
vector<string>::iterator it = unique(out.begin(), out.end());
|
71 |
vector<string>::iterator it = unique(out.begin(), out.end());
|
72 |
out.resize(it - out.begin());
|
72 |
out.resize(it - out.begin());
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
bool Query::Native::getMatchTerms(unsigned long xdocid, vector<string>& terms)
|
|
|
76 |
{
|
|
|
77 |
if (!xenquire) {
|
|
|
78 |
LOGERR(("Query::getMatchTerms: no query opened\n"));
|
|
|
79 |
return -1;
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
terms.clear();
|
|
|
83 |
Xapian::TermIterator it;
|
|
|
84 |
Xapian::docid id = Xapian::docid(xdocid);
|
|
|
85 |
|
|
|
86 |
XAPTRY(terms.insert(terms.begin(),
|
|
|
87 |
xenquire->get_matching_terms_begin(id),
|
|
|
88 |
xenquire->get_matching_terms_end(id)),
|
|
|
89 |
m_q->m_db->m_ndb->xrdb, m_q->m_reason);
|
|
|
90 |
|
|
|
91 |
if (!m_q->m_reason.empty()) {
|
|
|
92 |
LOGERR(("getMatchTerms: xapian error: %s\n", m_q->m_reason.c_str()));
|
|
|
93 |
return false;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
return true;
|
73 |
}
|
97 |
}
|
74 |
|
98 |
|
75 |
// Retrieve db-wide frequencies for the query terms and store them in
|
99 |
// Retrieve db-wide frequencies for the query terms and store them in
|
76 |
// the query object. This is done at most once for a query, and the data is used
|
100 |
// the query object. This is done at most once for a query, and the data is used
|
77 |
// while computing abstracts for the different result documents.
|
101 |
// while computing abstracts for the different result documents.
|
|
... |
|
... |
235 |
Xapian::Database& xrdb(ndb->xrdb);
|
259 |
Xapian::Database& xrdb(ndb->xrdb);
|
236 |
|
260 |
|
237 |
vector<string> terms;
|
261 |
vector<string> terms;
|
238 |
{
|
262 |
{
|
239 |
vector<string> iterms;
|
263 |
vector<string> iterms;
|
240 |
m_q->getMatchTerms(docid, iterms);
|
264 |
getMatchTerms(docid, iterms);
|
241 |
noPrefixList(iterms, terms);
|
265 |
noPrefixList(iterms, terms);
|
242 |
}
|
266 |
}
|
243 |
if (terms.empty()) {
|
267 |
if (terms.empty()) {
|
244 |
LOGDEB(("getFirstMatchPage: empty match term list (field match?)\n"));
|
268 |
LOGDEB(("getFirstMatchPage: empty match term list (field match?)\n"));
|
245 |
return -1;
|
269 |
return -1;
|
|
... |
|
... |
295 |
|
319 |
|
296 |
// The (unprefixed) terms matched by this document
|
320 |
// The (unprefixed) terms matched by this document
|
297 |
vector<string> matchedTerms;
|
321 |
vector<string> matchedTerms;
|
298 |
{
|
322 |
{
|
299 |
vector<string> iterms;
|
323 |
vector<string> iterms;
|
300 |
m_q->getMatchTerms(docid, iterms);
|
324 |
getMatchTerms(docid, iterms);
|
301 |
noPrefixList(iterms, matchedTerms);
|
325 |
noPrefixList(iterms, matchedTerms);
|
302 |
if (matchedTerms.empty()) {
|
326 |
if (matchedTerms.empty()) {
|
303 |
LOGDEB(("makeAbstract::Empty term list\n"));
|
327 |
LOGDEB(("makeAbstract::Empty term list\n"));
|
304 |
return ABSRES_ERROR;
|
328 |
return ABSRES_ERROR;
|
305 |
}
|
329 |
}
|