lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Karman <pe...@peknet.com>
Subject Re: [lucy-user] Case Sensitive Index with options to do Case In-Sensitive search
Date Sat, 01 Feb 2014 18:44:43 GMT
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

Mime
View raw message