问题描述
我不熟悉PayloadTermQuery的用法,并发现它适用于@ Search Hub中给出的示例中的简单匹配.
I am new to PayloadTermQuery usage and found it working for simple matches from the example given @ Search Hub.
与Lucene-4.1一样,我在PayloadTermQuery中找不到任何支持模糊查询的API.
As with Lucene-4.1, I couldn't find any API to support Fuzzy Query inside PayloadTermQuery.
您能帮助我理解为什么对术语规范有限制,而不是查询成为PayloadTermQuery构造函数的参数吗?
Can you help me in understanding why there is restriction on Term specification rather than Query being a parameter to PayloadTermQuery constructor ?
谢谢,Manu
推荐答案
FuzzyQuery从org.apache.lucene.search. MultiTermQuery 扩展而来,而PayloadTermQuery接受单个Term.
FuzzyQuery extends from org.apache.lucene.search.MultiTermQuery, whereas PayloadTermQuery accepts a single Term.
只能传递"Term"作为参数的限制是由于您正在构造的查询类型,即有效负载 TermQuery .
The restriction of being able to pass only 'Term' as the argument is because of the type of query you are constructing, which is Payload TermQuery.
如果它允许使用Query实例,则构造函数将最终接收包含多个术语的查询.
In case it allows a Query instance, the constructor will end up with receiving queries that contain multiple terms.
这篇关于PayloadTermQuery内部的模糊查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!