[Xapian-discuss] Unique Term Listings

richard at lemurconsulting.com richard at lemurconsulting.com
Tue Nov 7 14:10:26 GMT 2006


You want the "get_termfreq()" methods.

If you have a Xapian::MSet object, its get_termfreq() method will return
the term frequency for terms in the query used to generate it.

Alternatively, the Xapian::Database object has a get_termfreq() method
which will return the term frequency for any term in the database

The Xapian::MSet::get_termfreq() method can be faster (doesn't need to look
it up in the database, because it will already have been looked up when
performing the query), but will raise an exception if the term wasn't in
the query.

Omega uses the following to get the termfreq:

    try {
        value = int_to_string(mset.get_termfreq(args[0]));
    } catch (...) {
        value = int_to_string(db.get_termfreq(args[0]));
    }

(see line 1209 of query.cc in current SVN head).

-- 
Richard



More information about the Xapian-discuss mailing list