You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by vardhaman narasagoudar <va...@gmail.com> on 2015/08/14 12:44:29 UTC

How to use case in-sentive search

Dear Team,

I am trying to build a search engine for fetching person info based on name
or  email Id. For this I have standard Analyzer & wildcard. If I enter case
senstive query I get the result. but how to go about for case in-senstive

I mean if I search for rohan or Rohan should be same, Currently I  search
as per DB that is Rohan , I get the result & not for rohan.

I have posted the same query in Stack overflow
http://stackoverflow.com/questions/30881355/java-lucene-4-5-how-to-search-by-case-insensitive/30926385#30926385

Please help me out, is there any refernce where I can look in

-- 
Thanks & Regards
Vardhaman B.N
9945840928

Re: How to use case in-sentive search

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

Wildcard queries don't use the Analyzer, so they are case sensitive. Most of Lucene's query parsers allow to lowercase although there is a wildcard, but xou have to enable this. 

In most cases it is recommended to use a plain simple analyzer for fields using wildcards. If you also have stemming this will not work correctly with wildcards.

In general, if your queries require wildcards by default then you should review your analysis! A good configured analysis chain should allow the user to find stuff without using wildcards!!!

Uwe

Am 14. August 2015 16:12:46 MESZ, schrieb Jack Krupansky <ja...@gmail.com>:
>I was assuming this was a Lucene question...
>
>The StandardAnalyzer already includes the lower case filter, so the
>default
>should be case-insensitive query.
>
>See:
>https://lucene.apache.org/core/5_2_1/analyzers-common/org/apache/lucene/analysis/standard/StandardAnalyzer.html
>
>If the question was really how to get case-sensitive query, simply
>create
>your own analyzer without the lower case filter.
>
>
>-- Jack Krupansky
>
>On Fri, Aug 14, 2015 at 10:07 AM, Erick Erickson
><er...@gmail.com>
>wrote:
>
>> Add LowercaseFilterFactory to your analysis chain for the fieldType
>> both at query and index time. You'll need to re-index.
>>
>> The admin UI/analysis page will help you understand the effects
>> of each analysis step defined in your fieldTypes.
>>
>> Best,
>> Erick
>>
>> On Fri, Aug 14, 2015 at 3:44 AM, vardhaman narasagoudar
>> <va...@gmail.com> wrote:
>> > Dear Team,
>> >
>> > I am trying to build a search engine for fetching person info based
>on
>> name
>> > or  email Id. For this I have standard Analyzer & wildcard. If I
>enter
>> case
>> > senstive query I get the result. but how to go about for case
>in-senstive
>> >
>> > I mean if I search for rohan or Rohan should be same, Currently I 
>search
>> > as per DB that is Rohan , I get the result & not for rohan.
>> >
>> > I have posted the same query in Stack overflow
>> >
>>
>http://stackoverflow.com/questions/30881355/java-lucene-4-5-how-to-search-by-case-insensitive/30926385#30926385
>> >
>> > Please help me out, is there any refernce where I can look in
>> >
>> > --
>> > Thanks & Regards
>> > Vardhaman B.N
>> > 9945840928
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>

--
Uwe Schindler
H.-H.-Meier-Allee 63, 28213 Bremen
http://www.thetaphi.de

Re: How to use case in-sentive search

Posted by Jack Krupansky <ja...@gmail.com>.
I was assuming this was a Lucene question...

The StandardAnalyzer already includes the lower case filter, so the default
should be case-insensitive query.

See:
https://lucene.apache.org/core/5_2_1/analyzers-common/org/apache/lucene/analysis/standard/StandardAnalyzer.html

If the question was really how to get case-sensitive query, simply create
your own analyzer without the lower case filter.


-- Jack Krupansky

On Fri, Aug 14, 2015 at 10:07 AM, Erick Erickson <er...@gmail.com>
wrote:

> Add LowercaseFilterFactory to your analysis chain for the fieldType
> both at query and index time. You'll need to re-index.
>
> The admin UI/analysis page will help you understand the effects
> of each analysis step defined in your fieldTypes.
>
> Best,
> Erick
>
> On Fri, Aug 14, 2015 at 3:44 AM, vardhaman narasagoudar
> <va...@gmail.com> wrote:
> > Dear Team,
> >
> > I am trying to build a search engine for fetching person info based on
> name
> > or  email Id. For this I have standard Analyzer & wildcard. If I enter
> case
> > senstive query I get the result. but how to go about for case in-senstive
> >
> > I mean if I search for rohan or Rohan should be same, Currently I  search
> > as per DB that is Rohan , I get the result & not for rohan.
> >
> > I have posted the same query in Stack overflow
> >
> http://stackoverflow.com/questions/30881355/java-lucene-4-5-how-to-search-by-case-insensitive/30926385#30926385
> >
> > Please help me out, is there any refernce where I can look in
> >
> > --
> > Thanks & Regards
> > Vardhaman B.N
> > 9945840928
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: How to use case in-sentive search

Posted by Erick Erickson <er...@gmail.com>.
Add LowercaseFilterFactory to your analysis chain for the fieldType
both at query and index time. You'll need to re-index.

The admin UI/analysis page will help you understand the effects
of each analysis step defined in your fieldTypes.

Best,
Erick

On Fri, Aug 14, 2015 at 3:44 AM, vardhaman narasagoudar
<va...@gmail.com> wrote:
> Dear Team,
>
> I am trying to build a search engine for fetching person info based on name
> or  email Id. For this I have standard Analyzer & wildcard. If I enter case
> senstive query I get the result. but how to go about for case in-senstive
>
> I mean if I search for rohan or Rohan should be same, Currently I  search
> as per DB that is Rohan , I get the result & not for rohan.
>
> I have posted the same query in Stack overflow
> http://stackoverflow.com/questions/30881355/java-lucene-4-5-how-to-search-by-case-insensitive/30926385#30926385
>
> Please help me out, is there any refernce where I can look in
>
> --
> Thanks & Regards
> Vardhaman B.N
> 9945840928

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org