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
importluqum.parserlucene_query="field: value"luqum.parser.parser.parse(lucene_query)
# No errorimportplyaraluqum.parser.parser.parse(lucene_query)
# No errorplyara.Plyara()
luqum.parser.parser.parse(lucene_query)
# Error: luqum.exceptions.ParseSyntaxError: Syntax error in input : unexpected 'field' at position 0!
As opposed to #72, the example is failing in a single thread mode.
Also using luqum.thread.parse(lucene_query) may still fail depending of the ordering:
Before plyara.Plyara(): No error as the new global lexer was not changed yet
After plyara.Plyara(): Same error as lex.lexer.clone() is used instead of luqum.parser.lexer
luqum.thread.parse should use luqum.parser.lexer instead of lex.lexer.clone(). Also the lexer parameter in luqum.thread.parse is not even usable as a workaround.
Provide a parser interface that automatically use the luqum.parser.lexer. Although, there is a workaround, I still believe the user should not have to know PLY internal in order to use luqum in a global environment where other libraries may use PLY. It is the solution implemented by plyara.Plyara, so plyara is still parsing correctly even if luqum.parser would be imported first.
The text was updated successfully, but these errors were encountered:
Problem
As opposed to #72, the example is failing in a single thread mode.
Also using
luqum.thread.parse(lucene_query)
may still fail depending of the ordering:plyara.Plyara()
: No error as the new global lexer was not changed yetplyara.Plyara()
: Same error aslex.lexer.clone()
is used instead ofluqum.parser.lexer
Cause
luqum
is defining a globallexer
in https://github.com/jurismarches/luqum/blob/master/luqum/parser.py#L248 that is used "magically" byPLY
.The PLY documentation has a section Multiple Parsers and Lexers for multiple "lexer" usage.
Workaround
Idea
luqum.thread.parse
should useluqum.parser.lexer
instead oflex.lexer.clone()
. Also thelexer
parameter inluqum.thread.parse
is not even usable as a workaround.Provide a parser interface that automatically use the
luqum.parser.lexer
. Although, there is a workaround, I still believe the user should not have to knowPLY
internal in order to use luqum in a global environment where other libraries may use PLY. It is the solution implemented byplyara.Plyara
, soplyara
is still parsing correctly even ifluqum.parser
would be imported first.The text was updated successfully, but these errors were encountered: