Thanks,

I solved this problem. I found that if what i typed is lowercase, the result
is not case senstive, e.g. if search for "database" it would return
"DATABASE", "database". However, if what i typed is uppercase, the result is
case sensitive, e.g. if search for "DATABASE", no results would return. So I
just transfer the input to lowercae using toLower(), and it works.
Is there anyting wrong with this?

Wen



2011/2/22 Peter Mateja <peter.mat...@gmail.com>

> Wen,
> 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
> peter.mat...@gmail.com
>
>
>
> On Tue, Feb 22, 2011 at 3:13 PM, Wen Gao <samuel.gao...@gmail.com> 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
> >
>

Reply via email to