简体   繁体   English

如何在Lucene 4的搜索中获得多个单词

[英]How to get multple words in a search with Lucene 4

I'm trying to get a string with Lucene 4. Actually now I'm using SpanTermQuery , but it only is able to get simple words like "Walking", "dog" ..etc. 我正在尝试使用Lucene 4获取字符串。实际上,现在我正在使用SpanTermQuery,但是它只能获取简单的单词,例如“走路”,“狗” ..etc。 But what I want to do is get more complex as "The dog is walking". 但是我想做的事情变得更加复杂,因为“狗在走路”。

Is there any kind of query which does that? 请问有什么查询吗?

The "get multiple words" concept is very generic. “获取多个单词”的概念非常通用。 If you mean that you'd like to get a phrase like "the dog is walking" then you can use A SpanNearQuery specifying slop and in order where: 如果您要获取诸如“狗在走路”之类的短语,则可以使用A SpanNearQuery指定坡度并按以下顺序进行:

  • slop Is the maximum number of intervening unmatched positions permitted; slope是允许的最大不匹配中间位置数量;
  • inorder specifies if the matches have to be in order. inorder指定是否必须按顺序进行匹配。

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

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