jurismarches / luqum

A lucene query parser generating ElasticSearch queries and more !
Other
188 stars 40 forks source link

Support Surround Query Parser #66

Closed ghost closed 3 years ago

ghost commented 3 years ago

https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-SurroundQueryParser

Is Surround Query Parser not supported? like this: 3w(foo, bar) or (spot prices) 3w (gulf coast)

alexgarel commented 3 years ago

Sorry it is not and it's not on the roadmap.

It could be added but it should be in a sub package (to avoid confusion), with it's own package and additions to tree.py. Unfortunatley it's not easy with PLY to derive a parser from an existing one (it's still seems possible though, diving into PLY code to understand how to do it).

ghost commented 3 years ago

@alexgarel Thank you for your answer. Then I'd want to change the surround query to lucene query, do you know any way? Like this way:

surround query -> lucene query -> luqum -> es query
alexgarel commented 3 years ago

@urlence : the parser build a tree (see tree.py).

If your tree is compatible, no problem to use luqum to transform it to es query.

If your tree is not compatible, there are two ways:

Do'nt hesitate to dive in source or tests. If you have ideas of things we could document better, you are welcome !