ALL solr queries are case-sensitive.  

The trick is in the analyzers.  If you downcase everything at index time before 
you put it in the index, and downcase all queries at query time too -- then you 
have case-insensitive query.   Not because the Solr search algorithms are case 
insensitive, but because you've normalized all values to be all lowercase at 
both index and query time, so things will match. 

You can only do this kind of normalization through analyzers on a Solr text 
field, not a Solr string field. It's what the Solr text type is for. 

This wiki page, and this question in particular, will be helpful to you:
http://wiki.apache.org/solr/SolrRelevancyCookbook#Relevancy_and_Case_Matching
________________________________________
From: PeterKerk [vettepa...@hotmail.com]
Sent: Saturday, December 04, 2010 6:24 AM
To: solr-user@lucene.apache.org
Subject: Re: finding exact case insensitive matches on single and multiword 
values

Geert-Jan and Erick, thanks!

What I tried first is making it work with string type, that works perfect
for all lowercase values!

What I do not understand is how and why I have to make the casing work at
the client, since the casing differs in the database. Right now in the
database I have values for city:
Den Haag
Den HAAG
den haag
den haag

using &fq=city:(den\ haag) gives me 2 results.

So it seems to me that because of the string type this casing issue cannot
be resolved as long as I'm using this fieldtype?


Then to the solution of tweaking the fieldtype for me to work.
I have this right now:

        <fieldType name="myField" class="solr.TextField" sortMissingLast="true"
omitNorms="true">
        <analyzer>
                <tokenizer class="solr.KeywordTokenizerFactory"/>
                <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
        </fieldType>

But I find it difficult to test what the result of the filters are, and
since as Erick already mentioned, the result looks correct but really
isnt...
Is there some tool where I can add and remove the filters to quickly see
what the output will be? (without having to reload schema.xml and do
reimport?
--
View this message in context: 
http://lucene.472066.n3.nabble.com/finding-exact-case-insensitive-matches-on-single-and-multiword-values-tp2012207p2017851.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to