|
a/src/rcldb/rclquery.cpp |
|
b/src/rcldb/rclquery.cpp |
|
... |
|
... |
152 |
deleteZ(m_nq);
|
152 |
deleteZ(m_nq);
|
153 |
if (m_sorter) {
|
153 |
if (m_sorter) {
|
154 |
delete (QSorter*)m_sorter;
|
154 |
delete (QSorter*)m_sorter;
|
155 |
m_sorter = 0;
|
155 |
m_sorter = 0;
|
156 |
}
|
156 |
}
|
157 |
}
|
|
|
158 |
|
|
|
159 |
string Query::getReason() const
|
|
|
160 |
{
|
|
|
161 |
return m_reason;
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
Db *Query::whatDb()
|
|
|
165 |
{
|
|
|
166 |
return m_db;
|
|
|
167 |
}
|
157 |
}
|
168 |
|
158 |
|
169 |
void Query::setSortBy(const string& fld, bool ascending) {
|
159 |
void Query::setSortBy(const string& fld, bool ascending) {
|
170 |
if (fld.empty()) {
|
160 |
if (fld.empty()) {
|
171 |
m_sortField.erase();
|
161 |
m_sortField.erase();
|
|
... |
|
... |
271 |
return false;
|
261 |
return false;
|
272 |
}
|
262 |
}
|
273 |
return true;
|
263 |
return true;
|
274 |
}
|
264 |
}
|
275 |
|
265 |
|
276 |
bool Query::getMatchTerms(const Doc& doc, vector<string>& terms)
|
|
|
277 |
{
|
|
|
278 |
return getMatchTerms(doc.xdocid, terms);
|
|
|
279 |
}
|
|
|
280 |
bool Query::getMatchTerms(unsigned long xdocid, vector<string>& terms)
|
|
|
281 |
{
|
|
|
282 |
if (ISNULL(m_nq) || !m_nq->xenquire) {
|
|
|
283 |
LOGERR(("Query::getMatchTerms: no query opened\n"));
|
|
|
284 |
return -1;
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
terms.clear();
|
|
|
288 |
Xapian::TermIterator it;
|
|
|
289 |
Xapian::docid id = Xapian::docid(xdocid);
|
|
|
290 |
|
|
|
291 |
XAPTRY(terms.insert(terms.begin(),
|
|
|
292 |
m_nq->xenquire->get_matching_terms_begin(id),
|
|
|
293 |
m_nq->xenquire->get_matching_terms_end(id)),
|
|
|
294 |
m_db->m_ndb->xrdb, m_reason);
|
|
|
295 |
|
|
|
296 |
if (!m_reason.empty()) {
|
|
|
297 |
LOGERR(("getMatchTerms: xapian error: %s\n", m_reason.c_str()));
|
|
|
298 |
return false;
|
|
|
299 |
}
|
|
|
300 |
|
|
|
301 |
return true;
|
|
|
302 |
}
|
|
|
303 |
|
|
|
304 |
abstract_result Query::makeDocAbstract(Doc &doc,
|
266 |
abstract_result Query::makeDocAbstract(Doc &doc,
|
305 |
vector<Snippet>& abstract,
|
267 |
vector<Snippet>& abstract,
|
306 |
int maxoccs, int ctxwords)
|
268 |
int maxoccs, int ctxwords)
|
307 |
{
|
269 |
{
|
308 |
LOGDEB(("makeDocAbstract: maxoccs %d ctxwords %d\n", maxoccs, ctxwords));
|
270 |
LOGDEB(("makeDocAbstract: maxoccs %d ctxwords %d\n", maxoccs, ctxwords));
|
|
... |
|
... |
492 |
doc.meta[Doc::keyrr] = buf;
|
454 |
doc.meta[Doc::keyrr] = buf;
|
493 |
|
455 |
|
494 |
sprintf(buf, "%d", collapsecount);
|
456 |
sprintf(buf, "%d", collapsecount);
|
495 |
doc.meta[Rcl::Doc::keycc] = buf;
|
457 |
doc.meta[Rcl::Doc::keycc] = buf;
|
496 |
|
458 |
|
497 |
|
|
|
498 |
// Parse xapian document's data and populate doc fields
|
459 |
// Parse xapian document's data and populate doc fields
|
499 |
return m_db->m_ndb->dbDataToRclDoc(docid, data, doc);
|
460 |
return m_db->m_ndb->dbDataToRclDoc(docid, data, doc);
|
500 |
}
|
461 |
}
|
501 |
|
462 |
|
502 |
vector<string> Query::expand(const Doc &doc)
|
463 |
vector<string> Query::expand(const Doc &doc)
|