--- a/src/rcldb/rclquery.cpp
+++ b/src/rcldb/rclquery.cpp
@@ -226,6 +226,10 @@
 
 bool Query::getMatchTerms(const Doc& doc, list<string>& terms)
 {
+    return getMatchTerms(doc.xdocid, terms);
+}
+bool Query::getMatchTerms(unsigned long xdocid, list<string>& terms)
+{
     if (ISNULL(m_nq) || !m_nq->xenquire) {
 	LOGERR(("Query::getMatchTerms: no query opened\n"));
 	return -1;
@@ -233,7 +237,7 @@
 
     terms.clear();
     Xapian::TermIterator it;
-    Xapian::docid id = Xapian::docid(doc.xdocid);
+    Xapian::docid id = Xapian::docid(xdocid);
 
     XAPTRY(terms.insert(terms.begin(),
                         m_nq->xenquire->get_matching_terms_begin(id),