在python中解析Lucene查询的正确方法是什么?

jan*_*jan 4 python lucene

我需要从python中的lucene查询中解析术语和运算符.

语法在此处描述:http: //lucene.apache.org/core/2_9_4/queryparsersyntax.html

例如,我想从这样的查询中获取术语和运算符:

title:"The Right Way" AND text:go
Run Code Online (Sandbox Code Playgroud)

在python中是否存在用于lucene查询的解析器的现有模块?

我可以使用ply或pyparse编写解析器,但我想知道是否已存在或者是否存在替代解决方案.

Ken*_*chi 5

pyparsing在examples文件夹中提供了lucene解析器.pyparsing是用纯Python编写的,没有外部依赖.这似乎是最可靠的实现.