lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Mateja <>
Subject Re: [Lucene.Net] how to make the search not case sensitive
Date Tue, 22 Feb 2011 22:21:09 GMT
You need to make sure that you are using the same analyzer when both
indexing and searching in a particular index field.  For instance, in your
case, you need to ensure that the value "DATABASE" (in whatever field that
is in) is indexed with the StandardAnalyzer.  Then, use the StandardAnalyzer
to search that field.  This should find the match when you search for
"database", "DATABASE", "Database", etc, and return the original value
stored as "DATABASE".

Of course, if you need case sensitivity, then you'd use the KeywordAnalyzer.

If you've got a more complex index schema which requires different analyzers
per field, then you'll need to look into using the PerFieldAnalyzerWrapper
in order to correctly handle indexing and searching.

Peter Mateja

On Tue, Feb 22, 2011 at 3:13 PM, Wen Gao <> wrote:

> Hi,
> I am using lucene's standard analyser to search, however, the search result
> is case sensitive. e.g, when i search for "database", "DATABASE" could not
> return.
> I could store the typed items as lowercase, and store the stored data as
> lowercase as well, but in this case, the returned results would be lower
> case, instead of the original form. e.g, the returned results would be
> "database" instead of "DATABASE".
> Any ideas?
> Wen

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message