Michael Henson
2012-Mar-16 20:04 UTC
[Xapian-discuss] MSetIterator::get_percent Shows Increased Values When Using Query::OP_FILTER
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
Olly Betts
2012-Mar-16 22:16 UTC
[Xapian-discuss] MSetIterator::get_percent Shows Increased Values When Using Query::OP_FILTER
On Fri, Mar 16, 2012 at 04:04:58PM -0400, Michael Henson wrote:> 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?It's a bug, probably in counting the weighted leaf queries. I'll take a look, but it would be useful to open a ticket. Cheers, Olly