简体   繁体   English

Lucene搜索和喜欢子句

[英]Lucene Search with Like Clause

I have title search with Lucene .net and facing problem with LIKE clause search. 我使用Lucene .net进行标题搜索,并且在LIKE子句搜索中遇到问题。

I have tried below terms but it is matching whole word. 我尝试过以下术语,但它与整个单词匹配。

query.Add(new TermQuery(new Term("title", word.ToLower())), BooleanClause.Occur.MUST);

Also tried 也尝试过

query.Add(new TermQuery(new Term("title", word.ToLower())), BooleanClause.Occur.SHOULD);

Any idea how to apply LIKE clause? 任何想法如何应用LIKE子句?

I would guess you are probably looking for either Prefix or Wildcard queries. 我猜您可能正在寻找前缀通配符查询。

In general, I'd recommend getting some level of understanding of the instantiable subclasses of Query, listed here . 通常,建议您对Query的可实例化子类有一些了解,在此处列出

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

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