[Xapian-discuss] MSetIterator::get_percent Shows Increased Values When Using Query::OP_FILTER

Michael Henson hensom at gmail.com
Fri Mar 16 20:04:58 GMT 2012


I'm seeing some rather odd behavior with respect to the match percent that
is returned when performing a simple query. It appears that the addition of
a filter to a simple OR query will not affect the weight of the match, but
will increase the percent of the resulting match. According to the
documentation for MSetIterator::get_percent (
http://xapian.org/docs/apidoc/html/classXapian_1_1MSetIterator.html#99514c11a9291175d20fafa73a0839fd)
a match should only get 100% if it matches all of the weight contributing
terms in the query.

I've attached a test case that shows the odd behavior that I am seeing. I
had a database with 2 documents, each with one term 'cold' and 'kid'. Each
document also has a boolean term for the owner of the document 'Ome'.

Below are the results for a search for 'cold kids' on that set with and
without the owner filter. The weight 0.405465108108 stays the same for both
queries, but the percentage increases from 50 to 100 with the addition of
the filter.

Query: Xapian::Query((cold OR kids))
1 - 0.405465108108 - 50 - Ome, cold
2 - 0.405465108108 - 50 - Ome, kids

Query: Xapian::Query(((cold OR kids) FILTER Ome))
1 - 0.405465108108 - 100 - Ome, cold
2 - 0.405465108108 - 100 - Ome, kids


Is this the expected behavior here, or have I encountered a bug?

-- Michael


More information about the Xapian-discuss mailing list