Closed erlichmen closed 7 years ago
hello, sorry I'm on vacation, mainly AFK.
As a first short answer, the choice of OR or AND as the implicit operator is a choice than can be made later (see eg the default_operator argument in Query String Query and in luqum.elasticsearch.visitor.ElasticsearchQueryBuilder.__init__
).
That's why the parser prefers to use this specific UnknowOperation
node.
So you can either decide to use a visitor to replace the UnknownOperation
to a OrOperation
or treat UnknownOperation
as a OrOperation
in your code.
Hope it's clear enough !
Hello @erlichmen, can you get a look at https://github.com/jurismarches/luqum/pull/12 and tell me if this solutions seems ok to you.
@erlichmen did you look into it ? Without any response within two weeks I'll close this ticket. Thanks.
@alexgarel Works for me!.
For any reader who is wondering how to use it:
from luqum.parser import parser
from luqum.tree import AndOperation
from luqum.utils import UnknownOperationResolver
unk_op_resolver = UnknownOperationResolver(AndOperation)
tree = unk_op_resolver(parser.parse('foo bar'))
good idea to put the code here @impredicative. There is also a reference in the doc
The following should be a valid lucene syntax:
it should equivalent to:
But I get UnknowOperation instead of OrOperation when parsing the string.