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 meghana <me...@amultek.com> on 2012/08/22 12:31:57 UTC

Solr - case-insensitive search do not work

I want to apply case-insensitive search for field *myfield* in solr.

I googled a bit for that , and i found that , i need to apply
*LowerCaseFilterFactory *to Field Type and field should be of
solr.TextFeild.

I applied that in my *schema.xml* and re-index the data, then also my search
seems to be case-sensitive.

Below is search that i perform.
*
http://localhost:8080/solr/select?q=myfield:"cloud
university"&hl=on&hl.snippets=99&hl.fl=myfield*

Below is definition for field type

 <fieldType name="text_en_splitting" class="solr.TextField"
positionIncrementGap="100" autoGeneratePhraseQueries="true">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        
        
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords_en.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords_en.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="0"
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
    </fieldType>

and below is my field definition

 <field name="myfield" type="text_en_splitting" indexed="true" stored="true"
/>

Not sure , what is wrong with this. Please help me to resolve this.

Thanks




--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - case-insensitive search do not work

Posted by Ravish Bhagdev <ra...@gmail.com>.
Did you see my message about debugging parameters?  Try that and see what's
happening behind the scenes.

I can confirm that by default the queries are NOT case sensitive.

Ravish

On Wed, Aug 22, 2012 at 2:45 PM, meghana <me...@amultek.com> wrote:

> Hi Ravish , the defination for text_en_splitting in solr default schema and
> of mine are same.. still its not working... any idea?
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605p4002645.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr - case-insensitive search do not work

Posted by meghana <me...@amultek.com>.
Hi Ravish , the defination for text_en_splitting in solr default schema and
of mine are same.. still its not working... any idea?




--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605p4002645.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - case-insensitive search do not work

Posted by meghana <me...@amultek.com>.
Hmm... I try out that.



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605p4002628.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - case-insensitive search do not work

Posted by Ravish Bhagdev <ra...@gmail.com>.
Also, try comparing your field configuration to Solrs default text field
and see if you can spot any differences.

Ravish

On Wed, Aug 22, 2012 at 1:09 PM, Ravish Bhagdev <ra...@gmail.com>wrote:

> OK.  Try without quotes like myfield:cloud+university and see if it has
> any effect.
>
> Also, try both queries with debugging turned on and post the output of the
> same ( http://wiki.apache.org/solr/CommonQueryParameters#Debugging )
>
> It must be some field configuration issue or that double quotes are
> causing some analyzers to not work on your query.
>
> Hope this helps.
>
> Ravish
>
> On Wed, Aug 22, 2012 at 12:11 PM, meghana <me...@amultek.com>wrote:
>
>> @Ravish Bhagdev , Yes I am adding double quotes around my search , as
>> shown
>> in my post. Like,
>>
>> myfield:"cloud university"
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605p4002610.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>

Re: Solr - case-insensitive search do not work

Posted by Ravish Bhagdev <ra...@gmail.com>.
OK.  Try without quotes like myfield:cloud+university and see if it has any
effect.

Also, try both queries with debugging turned on and post the output of the
same ( http://wiki.apache.org/solr/CommonQueryParameters#Debugging )

It must be some field configuration issue or that double quotes are causing
some analyzers to not work on your query.

Hope this helps.

Ravish

On Wed, Aug 22, 2012 at 12:11 PM, meghana <me...@amultek.com>wrote:

> @Ravish Bhagdev , Yes I am adding double quotes around my search , as shown
> in my post. Like,
>
> myfield:"cloud university"
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605p4002610.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr - case-insensitive search do not work

Posted by meghana <me...@amultek.com>.
@Ravish Bhagdev , Yes I am adding double quotes around my search , as shown
in my post. Like,

myfield:"cloud university"





--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605p4002610.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - case-insensitive search do not work

Posted by Ravish Bhagdev <ra...@gmail.com>.
 <filter class="solr.LowerCaseFilterFactory"/> is already present in your
field type definition (its twice now)

Are you adding quotes around your query by any chance?

Ravish

On Wed, Aug 22, 2012 at 11:31 AM, meghana <me...@amultek.com>wrote:

> I want to apply case-insensitive search for field *myfield* in solr.
>
> I googled a bit for that , and i found that , i need to apply
> *LowerCaseFilterFactory *to Field Type and field should be of
> solr.TextFeild.
>
> I applied that in my *schema.xml* and re-index the data, then also my
> search
> seems to be case-sensitive.
>
> Below is search that i perform.
> *
> http://localhost:8080/solr/select?q=myfield:"cloud
> university"&hl=on&hl.snippets=99&hl.fl=myfield*
>
> Below is definition for field type
>
>  <fieldType name="text_en_splitting" class="solr.TextField"
> positionIncrementGap="100" autoGeneratePhraseQueries="true">
>       <analyzer type="index">
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>
>
>         <filter class="solr.StopFilterFactory"
>                 ignoreCase="true"
>                 words="stopwords_en.txt"
>                 enablePositionIncrements="true"
>                 />
>         <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="1"
> catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.KeywordMarkerFilterFactory"
> protected="protwords.txt"/>
>         <filter class="solr.PorterStemFilterFactory"/>
>       </analyzer>
>       <analyzer type="query">
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
>         <filter class="solr.StopFilterFactory"
>                 ignoreCase="true"
>                 words="stopwords_en.txt"
>                 enablePositionIncrements="true"
>                 />
>         <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="0"
> catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.KeywordMarkerFilterFactory"
> protected="protwords.txt"/>
>         <filter class="solr.PorterStemFilterFactory"/>
>       </analyzer>
>     </fieldType>
>
> and below is my field definition
>
>  <field name="myfield" type="text_en_splitting" indexed="true"
> stored="true"
> />
>
> Not sure , what is wrong with this. Please help me to resolve this.
>
> Thanks
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-case-insensitive-search-do-not-work-tp4002605.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>