[Xapian-tickets] [Xapian] #201: Attempting to create a NEAR search with two OR nodes gives assertion error

Xapian nobody at xapian.org
Tue Dec 16 15:21:34 GMT 2008


#201: Attempting to create a NEAR search with two OR nodes gives assertion error
-------------------------+--------------------------------------------------
 Reporter:  richard      |        Owner:  olly     
     Type:  defect       |       Status:  assigned 
 Priority:  normal       |    Milestone:  1.1.0    
Component:  Library API  |      Version:  SVN trunk
 Severity:  normal       |   Resolution:           
 Keywords:               |    Blockedby:           
 Platform:  All          |     Blocking:           
-------------------------+--------------------------------------------------

Old description:

> I've observed this from python, but I expect it can occur from C++ too.
> The
> following python script gives an assertion error:
>
> import xapian
> a=xapian.Query('A')
> b=xapian.Query('B')
> c=xapian.Query(xapian.Query.OP_OR, a, b)
> d=xapian.Query(xapian.Query.OP_NEAR, c, c)
>
> The error is:
> xapian.AssertionError:
> /home/richard/private/Working/xapian/xapian-
> core/api/omqueryinternal.cc:770: op
> == Xapian::Query::OP_NEAR || op == Xapian::Query::OP_PHRASE
>
> This is because an attempt is made to flatten the query "(A OR B) NEAR (A
> OR
> B)", which isn't supported (I believe).  It would be nice to fix this by
> supporting such searches, but meanwhile we shouldn't raise AssertionError
> from
> the API; a more explanatory exception should be returned instead.

New description:

 I've observed this from python, but I expect it can occur from C++ too.
 The
 following python script gives an assertion error:

 {{{
 import xapian
 a=xapian.Query('A')
 b=xapian.Query('B')
 c=xapian.Query(xapian.Query.OP_OR, a, b)
 d=xapian.Query(xapian.Query.OP_NEAR, c, c)
 }}}

 The error is:
 {{{
 xapian.AssertionError:
 /home/richard/private/Working/xapian/xapian-
 core/api/omqueryinternal.cc:770: op == Xapian::Query::OP_NEAR || op ==
 Xapian::Query::OP_PHRASE
 }}}
 This is because an attempt is made to flatten the query "(A OR B) NEAR (A
 OR
 B)", which isn't supported (I believe).  It would be nice to fix this by
 supporting such searches, but meanwhile we shouldn't raise !AssertionError
 from
 the API; a more explanatory exception should be returned instead.

--

Comment(by olly):

 Fix formatting of description.

 We should at least fix the !AssertionError here, and that should be easy
 to do so let's try to do it for 1.0.0.

 I did work on a patch to implement NEAR and PHRASE over subqueries but I
 didn't fully finish it and I'm not sure where it is now.

-- 
Ticket URL: <http://trac.xapian.org/ticket/201#comment:7>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list