You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refer f667d38
We get a xapian exception while trying to parse "Alice & Bob". The error arises because Xapian operators OP_PHRASE and OP_NEAR only support leaf subqueries.
The text was updated successfully, but these errors were encountered:
maneeshpm
changed the title
Xapian queryparser fails when the querystring contains ampersand
Xapian queryparser fails when the querystring contains ampersand or other non words
Apr 15, 2021
@veloman-yunkan Documenting the following issues about using Xapian Query Parser with OP_PHRASE/OP_NEAR as default operator for future reference:
Standalone ampersand works fine. "&" gets parsed to "", it gets escaped.
For some reason, ampersand with exactly two words works fine as well. "Alice & bob" gets parsed to "alice bob".
As the number of words increases xapian throws an error. "0posanchor Alice & Bob" fails. This also fails at any combination of 3+ words with an ampersand anywhere in between terms or at the beginning. For some reason, it works when the ampersand is at the end.
This was the reason for the failure of the unit test. "Alice & Bob" got parsed till subquery_phrase but failed on subqery_anchored due to the additional anchor term.
As far as fixing this issue is concerned, as you suggested we should use OP_OR as default operator and bind the terms using a query constructor with OP_PHRASE.
Refer f667d38
We get a xapian exception while trying to parse "Alice & Bob". The error arises because Xapian operators
OP_PHRASE
andOP_NEAR
only support leaf subqueries.The text was updated successfully, but these errors were encountered: