You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jamie Johnson <je...@gmail.com> on 2011/06/21 18:53:31 UTC

case insensitive searches but return original case

Is it possible to do case insensitive searches but return the original
case?  So for instance the original field is:

John Smith

I need to be able to do case insensitive searches tokenized searches, but
when the value is returned for faceting I'd like the value to be just "John
Smith", not "john" and "smith" or "john smith".  Is this possible?  I know I
can probably do this by having an additional field which is for faceting and
another which is for searching (won't give me case insensitive I don't
think) but is there a more elegant way to do this?

Re: case insensitive searches but return original case

Posted by Erick Erickson <er...@gmail.com>.
Right. I'm saying that you can store one or the other, but there
is no good reason to store both. The facet values are the
values retrieved from the index, not the stored values. So you
can pull the stored values from either the searchable author field
just fine....

Best
Erick

On Tue, Jun 21, 2011 at 2:03 PM, Jamie Johnson <je...@gmail.com> wrote:
> Thanks for the reply, I did see that but I am displaying the information in
> that field as well so I'll need to store them for this case.  For fields I
> don't need to display I know that I can just tell it not to store it.
>
> On Tue, Jun 21, 2011 at 1:34 PM, Erick Erickson <er...@gmail.com>wrote:
>
>> Not really. The problem here is that facets are done on terms. To
>> search effectively, Solr needs tokenized, lower-cased etc. terms.
>>
>> But since faceting is really just faceting on terms, this is incompatible
>> with returning multi-term facets like "John Smith" so about all you can
>> do is to copyfield to an un-analyzed field and facet on that... Note that
>> you do NOT have to store the field you facet on BTW.
>>
>> Best
>> Erick
>>
>> On Tue, Jun 21, 2011 at 12:53 PM, Jamie Johnson <je...@gmail.com> wrote:
>> > Is it possible to do case insensitive searches but return the original
>> > case?  So for instance the original field is:
>> >
>> > John Smith
>> >
>> > I need to be able to do case insensitive searches tokenized searches, but
>> > when the value is returned for faceting I'd like the value to be just
>> "John
>> > Smith", not "john" and "smith" or "john smith".  Is this possible?  I
>> know I
>> > can probably do this by having an additional field which is for faceting
>> and
>> > another which is for searching (won't give me case insensitive I don't
>> > think) but is there a more elegant way to do this?
>> >
>>
>

Re: case insensitive searches but return original case

Posted by Jamie Johnson <je...@gmail.com>.
Thanks for the reply, I did see that but I am displaying the information in
that field as well so I'll need to store them for this case.  For fields I
don't need to display I know that I can just tell it not to store it.

On Tue, Jun 21, 2011 at 1:34 PM, Erick Erickson <er...@gmail.com>wrote:

> Not really. The problem here is that facets are done on terms. To
> search effectively, Solr needs tokenized, lower-cased etc. terms.
>
> But since faceting is really just faceting on terms, this is incompatible
> with returning multi-term facets like "John Smith" so about all you can
> do is to copyfield to an un-analyzed field and facet on that... Note that
> you do NOT have to store the field you facet on BTW.
>
> Best
> Erick
>
> On Tue, Jun 21, 2011 at 12:53 PM, Jamie Johnson <je...@gmail.com> wrote:
> > Is it possible to do case insensitive searches but return the original
> > case?  So for instance the original field is:
> >
> > John Smith
> >
> > I need to be able to do case insensitive searches tokenized searches, but
> > when the value is returned for faceting I'd like the value to be just
> "John
> > Smith", not "john" and "smith" or "john smith".  Is this possible?  I
> know I
> > can probably do this by having an additional field which is for faceting
> and
> > another which is for searching (won't give me case insensitive I don't
> > think) but is there a more elegant way to do this?
> >
>

Re: case insensitive searches but return original case

Posted by Erick Erickson <er...@gmail.com>.
Not really. The problem here is that facets are done on terms. To
search effectively, Solr needs tokenized, lower-cased etc. terms.

But since faceting is really just faceting on terms, this is incompatible
with returning multi-term facets like "John Smith" so about all you can
do is to copyfield to an un-analyzed field and facet on that... Note that
you do NOT have to store the field you facet on BTW.

Best
Erick

On Tue, Jun 21, 2011 at 12:53 PM, Jamie Johnson <je...@gmail.com> wrote:
> Is it possible to do case insensitive searches but return the original
> case?  So for instance the original field is:
>
> John Smith
>
> I need to be able to do case insensitive searches tokenized searches, but
> when the value is returned for faceting I'd like the value to be just "John
> Smith", not "john" and "smith" or "john smith".  Is this possible?  I know I
> can probably do this by having an additional field which is for faceting and
> another which is for searching (won't give me case insensitive I don't
> think) but is there a more elegant way to do this?
>