简体   繁体   English

解释Lucene的查询

[英]Interpret Queries of Lucene

I was wondering if there is any way to interpret Queries of Lucene in simple terms? 我想知道是否有任何方法可以用简单的术语来解释“ Lucene查询”?

For example : 例如 :

Example # 1: 范例1:

Input Query - name:John 输入查询-名称:John

Output - Interpreted as : Find all entries where attribute "name" is equal "John". 输出-解释为:查找属性“名称”等于“约翰”的所有条目。

Example # 2: 范例2:

Input Query - name:John AND phoneNumber:1234 输入查询-名称:John AND phoneNumber:1234

Output - Interpreted as : Find all entries where attribute "name" is equal to "John" and attribute "phoneNumber" is equal to "1234". 输出-解释为:查找属性“名称”等于“ John”且属性“ phoneNumber”等于“ 1234”的所有条目。

Any tutorials in this regard will be helpful, 任何有关这方面的教程都会有所帮助,

Thanks 谢谢

The Lucene documentation does a pretty decent job in explaining basic queries and their interpretation. Lucene文档在解释基本查询及其解释方面做得相当不错。 It seems as though that's all you're looking for; 似乎这就是您要寻找的全部; once you get into some of the more advanced query types, it gets hairy, but the documentation should always be your first stop; 一旦您进入一些更高级的查询类型,它就会变得很繁琐,但是文档始终应该是您的第一站; it's fairly comprehensive. 它相当全面。

Edit: Ah, you want automated query explanation. 编辑:啊,你想要自动查询解释。 I don't know of any that currently exist; 我不知道目前有什么。 I think you'll have to write your own, but if you're starting with standard QueryParser Syntax, I think the best input for your interpreter would be the output of QueryParser.parse() . 我认为您必须自己编写,但是如果您从标准QueryParser语法开始,我认为对您的解释器来说最好的输入是QueryParser.parse()的输出。 That breaks down the free text into Lucene query objects that shouldn't be too difficult to wrap in a utility function that outputs a plain-English string for each one. 这样可以将自由文本分解为Lucene查询对象,将它们包装在实用工具函数中应该不会太困难,该实用工具函数为每个对象输出一个纯英语字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM