Opened 12 years ago

Closed 12 years ago

#590 closed defect (fixed)

MSetIterator::get_percent Shows Increased Values When Using Query::OP_FILTER

Reported by: Michael Henson Owned by: Olly Betts
Priority: normal Milestone: 1.2.10
Component: Matcher Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description (last modified by Olly Betts)

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

Attachments (2)

bool-filter-test.py (751 bytes ) - added by Michael Henson 12 years ago.
Test Case Illustrating the Bug
percentage-filter-fix.patch (445 bytes ) - added by Olly Betts 12 years ago.
Candidate fix

Download all attachments as: .zip

Change History (5)

by Michael Henson, 12 years ago

Attachment: bool-filter-test.py added

Test Case Illustrating the Bug

by Olly Betts, 12 years ago

Attachment: percentage-filter-fix.patch added

Candidate fix

comment:1 by Olly Betts, 12 years ago

Component: OtherMatcher
Milestone: 1.3.1
Status: newassigned

The attached patch fixes your testcase for me on trunk. I'll apply it once I've got a testcase for the testsuite.

1.2.x probably has the same issue, so this probably wants backporting. What version are you seeing this with?

comment:2 by Olly Betts, 12 years ago

Description: modified (diff)
Milestone: 1.3.11.2.10

Fixed in trunk by r16429. The testcase I added fails with 1.2, so I guess this fix needs backporting.

comment:3 by Olly Betts, 12 years ago

Resolution: fixed
Status: assignedclosed

Backported for 1.2.10 in r16449.

Note: See TracTickets for help on using tickets.