[Xapian-discuss] Incorrect get_matches_estimated() of Xapian::Mset

Olly Betts olly at survex.com
Thu Sep 20 14:27:34 BST 2007


On Thu, Sep 20, 2007 at 07:56:52PM +0800, Hightman(??????) wrote:
> So I get an conclusion, XAPIAN count the estimate number by the
> percentage of the FILTER term in all documents .... :(   How can I
> fixed this error??

It's not really an error - get_matches_estimated() returns an *estimate*
so it's allowed to be wrong.  By default Xapian will favour retrieval
speed over getting the estimate more correct.

> But now, I found it get a disparity between the return value and real
> mathced number. For an example: the real matched number is 58, but the
> return value is 458; so when the users click the hinder page, get a
> blank page ... so they often complain to me.

If you want to ensure the estimate is correct below a certain value
(e.g. to allow reliably generation of paging buttons in your UI), set
the check_at_least parameter to Enquire::get_mset().  See the
documentation for the details, or look at the code to Omega to see how
it implements this.

Cheers,
    Olly



More information about the Xapian-discuss mailing list