Ticket #254 (assigned defect)

Opened 7 months ago

Last modified 3 months ago

Setting QueryParser default_op to OP_NEAR doesn't set an explicit window size

Reported by: kevinduraj Owned by: olly
Priority: normal Milestone: 1.1.0
Component: QueryParser Version: 1.0.7
Severity: normal Keywords:
Cc: Blocked By:
Operating System: All Blocking:

Description

When searching with more then 2 parameters on Boolean operator NEAR it throws and error: Exception: Can't use NEAR/PHRASE with a subexpression containing NEAR or PHRASE

Test case: http://myhealthcare.com/cgi-bin/search?q=american+actor+kevin&bool=near

-Kevin Duraj

Change History

Changed 7 months ago by kevinduraj

  • component changed from Other to QueryParser

Changed 7 months ago by olly

  • owner changed from newbugs to olly
  • platform changed from Linux to All

A test case on a website isn't much use. I can't fire it up in the debugger to find out why something happens, nor use it to verify that a fix works.

Am I right in thinking this arises when using code something like:

queryparser.set_default_op(Xapian::Query::OP_NEAR);

Changed 7 months ago by kevinduraj

Yes, this is the exact code used.

$qp = Search::Xapian::QueryParser?->new(); $qp->set_default_op(OP_NEAR); $enq = $db->enquire($qp->parse_query($terms));

Changed 4 months ago by olly

  • keywords NEAR removed
  • status changed from new to assigned
  • summary changed from Boolean operator NEAR does not accept more than 2 params to Setting QueryParser default_op to OP_NEAR doesn't set an explicit window size
  • version changed from 1.0.6 to 1.0.7
  • milestone changed from 1.0.7 to 1.0.8

This will work in 1.0.7 for multiple terms as well as it does for just two terms in 1.0.6.

But that's not actually very well - the window size for the OP_NEAR isn't set explicitly, so the default of the number of terms is used. I think it would make more sense to default_op of OP_NEAR to work much like an explicit a NEAR b NEAR c. So I'm going to keep this bug open for this remaining issue, but retitle appropriately.

Changed 3 months ago by olly

  • milestone changed from 1.0.8 to 1.1.0

Pushing back to 1.1.0.

Note: See TracTickets for help on using tickets.