Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#406 closed defect (fixed)

When defaultOp is AND, QueryParser produces <matchNothing> for requests containing a wildcard term and at least two stopwords

Reported by: Daniel Ménard Owned by: Olly Betts
Priority: normal Milestone: 1.0.17
Component: QueryParser Version: 1.0.16
Severity: normal Keywords:
Cc: daniel.menard@… Blocked By:
Blocking: Operating System: All

Description

One of my users reported that our search engine was not always removing stopwords from the user query.

By investigating, I found that the query parser was returning a <matchNothing> Query for requests containing a wildcard and at least two stopwords, but only when defaultOp is AND (everyhing is fine if defaultOp is OR).

Attached is a small PHP script which reproduce the problem.

On my machine (Windows XP, Xapian php-bindings 1.0.16 binaries from flax.co.uk, php 5.2.9-2), this script produces the following output:

C:\php>php b:\test.php
PHP version 5.2.9-2, Xapian version 1.0.16

Creating a new db containing a document with terms : test, tester, testable, user,

-------------- DefaultOp=OR--------------
query: this is a test
result: Xapian::Query(test:(pos=4))

query: test*
result: Xapian::Query((test:(pos=1) OR testable:(pos=1) OR tester:(pos=1)))

query: a test*
result: Xapian::Query((test:(pos=2) OR testable:(pos=2) OR tester:(pos=2)))

query: is a test*
result: Xapian::Query((test:(pos=3) OR testable:(pos=3) OR tester:(pos=3)))

query: this is a test*
result: Xapian::Query((test:(pos=4) OR testable:(pos=4) OR tester:(pos=4)))

query: this is a us* test*
result: Xapian::Query((user:(pos=4) OR test:(pos=5) OR testable:(pos=5) OR tester:(pos=5)))

query: this is a user test*
result: Xapian::Query((user:(pos=4) OR test:(pos=5) OR testable:(pos=5) OR tester:(pos=5)))

-------------- DefaultOp=AND--------------
query: this is a test
result: Xapian::Query(test:(pos=4))

query: test*
result: Xapian::Query((test:(pos=1) OR testable:(pos=1) OR tester:(pos=1)))

query: a test*
result: Xapian::Query((test:(pos=2) OR testable:(pos=2) OR tester:(pos=2)))

query: is a test*
result: Xapian::Query()
FAILS.

query: this is a test*
result: Xapian::Query()
FAILS.

query: this is a us* test*
result: Xapian::Query()
FAILS.

query: this is a user test*
result: Xapian::Query((user:(pos=4) AND (test:(pos=5) OR testable:(pos=5) OR tester:(pos=5))))

The problem is very specific: the query must contain a wildcard term, at least two stop words (1 wildcard + 1 stopword works well!) and no other term.

Also, the problem is not new: I've tested with xapian 1.0.11 and 1.0.12 which produce the same output.

Attachments (1)

test.php (2.5 KB ) - added by Daniel Ménard 15 years ago.
PHP script which reproduce the problem

Download all attachments as: .zip

Change History (5)

by Daniel Ménard, 15 years ago

Attachment: test.php added

PHP script which reproduce the problem

comment:1 by Olly Betts, 15 years ago

Milestone: 1.1.3
Status: newassigned

Reproduces for me with trunk.

Marking for 1.1.3, at least for now.

comment:2 by Olly Betts, 15 years ago

Milestone: 1.1.31.0.17

Fixed in trunk r13583 (one line fix!)

Marking for backport for 1.0.17.

comment:3 by Olly Betts, 15 years ago

Resolution: fixed
Status: assignedclosed

Backported for 1.0.17 in r13596.

comment:4 by Daniel Ménard, 15 years ago

Great!

Thanks a lot, Olly.

Note: See TracTickets for help on using tickets.