如何使lucene不区分大小写 [英] how to make lucene be case-insensitive

查看:151
本文介绍了如何使lucene不区分大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,单词Word和单词不相同。如何让Lucene不区分大小写呢?

By default word "Word" and "word" are not the same. How can I make Lucene be case-insensitive?

推荐答案

最简单的方法是降低所有可搜索内容以及查询。请参阅 LowerCaseFilter 文档。您还可以使用通配符查询不区分大小写的搜索,因为它绕过 Analyzer

The easiest approach is lowercasing all searchable content, as well as the queries. See the LowerCaseFilter documentation. You could also use Wildcard queries for case insensitive search since it bypasses the Analyzer.

如果愿意,您可以将内容存储在不同的字段中以捕获不同的案例配置。

You can store content in different fields to capture different case configurations if preferred.

这篇关于如何使lucene不区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆