You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucy.apache.org by "Nick D." <nd...@globaldataguard.com> on 2014/01/31 22:59:59 UTC

[lucy-user] Case Sensitive Index with options to do Case In-Sensitive search

Hi all,

I see that by not including the CaseFolder in my PolyAnalyzer at index time,
I can do case sensitive searches. Is there a way to do a case insensitive
search on an index that was stored case sensitive?

Example:

Store this: "This is an Example of what a case Sensitive line would be"

Search for this: "Example"
Also search for this: "example"

And return the line stored for both searches.

I have a need to have the option to do case insensitive and case sensitive
searches at search time and having 2 indexes (1 for each case) is not really
an option due to the amount of live data (data constantly coming off the
wire) being indexed at once.



--
View this message in context: http://lucene.472066.n3.nabble.com/Case-Sensitive-Index-with-options-to-do-Case-In-Sensitive-search-tp4114761.html
Sent from the lucy-user mailing list archive at Nabble.com.

Re: [lucy-user] Case Sensitive Index with options to do Case In-Sensitive search

Posted by Peter Karman <pe...@peknet.com>.
On 1/31/14 3:59 PM, Nick D. wrote:

> Store this: "This is an Example of what a case Sensitive line would be"
>
> Search for this: "Example"
> Also search for this: "example"
>
> And return the line stored for both searches.
>
> I have a need to have the option to do case insensitive and case sensitive
> searches at search time and having 2 indexes (1 for each case) is not really
> an option due to the amount of live data (data constantly coming off the
> wire) being indexed at once.


Store the same text under two different fields in the same index, one 
with an Analyzer w/CaseFolder (foo_lc) and one w/o (foo_cs).

Then your query parser can expand your query to an 'OR' search for both 
fields. The alias_for feature in Search::Query::Parser could help:

  my $parser = Search::Query::Parser->new(
     dialect => 'Lucy',
     fields  => {
         foo => [qw( foo_lc foo_cs )],
     },
  );

https://metacpan.org/pod/Search::Query::Field#alias_for


-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

Re: [lucy-user] Case Sensitive Index with options to do Case In-Sensitive search

Posted by Nick Wellnhofer <we...@aevum.de>.
On Jan 31, 2014, at 22:59 , Nick D. <nd...@globaldataguard.com> wrote:

> I see that by not including the CaseFolder in my PolyAnalyzer at index time,
> I can do case sensitive searches. Is there a way to do a case insensitive
> search on an index that was stored case sensitive?

Not really. You could write a custom query class, but it won’t be very efficient.

> I have a need to have the option to do case insensitive and case sensitive
> searches at search time and having 2 indexes (1 for each case) is not really
> an option due to the amount of live data (data constantly coming off the
> wire) being indexed at once.

You don’t have to create two separate indexes. You can create a single index with two fields. One for case-insensitive matching with a CaseFolder and another for case-sensitive matching without.

Nick