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 Mysurf Mail <st...@gmail.com> on 2013/09/08 18:28:39 UTC

Solr suggest - How to define solr suggest as case insensitive

My suggest (spellchecker) is returning case sensitive answers. (I use it to
autocomplete - dog and Dog return different phrases)\

my suggest is defined as follows - in solrconfig -

 <searchComponent class="solr.SpellCheckComponent" name="suggest">
<lst name="spellchecker">
    <str name="name">suggest</str>
    <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
    <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
    <str name="field">suggest</str>  <!-- the indexed field to derive
suggestions from -->
    <float name="threshold">0.005</float>
    <str name="buildOnCommit">true</str>
    <!--<str name="sourceLocation">american-english</str>-->
</lst>
</searchComponent>
<requestHandler
class="org.apache.solr.handler.component.SearchHandler"
name="/suggest">
    <lst name="defaults">
        <str name="spellcheck">true</str>
        <str name="spellcheck.dictionary">suggest</str>
        <str name="spellcheck.onlyMorePopular">true</str>
        <str name="spellcheck.count">5</str>
        <str name="spellcheck.collate">true</str>
    </lst>
    <arr name="components">
        <str>suggest</str>
    </arr>
</requestHandler>

in schema

<field name="suggest" type="phrase_suggest" indexed="true"
stored="true" required="false" multiValued="true"/>

and

<copyField source="Name" dest="suggest"/>

and

<fieldtype name="phrase_suggest" class="solr.TextField">
  <analyzer>
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class="solr.PatternReplaceFilterFactory"
            pattern="([^\p{L}\p{M}\p{N}\p{Cs}]*[\p{L}\p{M}\p{N}\p{Cs}\_]+:)|([^\p{L}\p{M}\p{N}\p{Cs}])+"
            replacement=" " replace="all"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.TrimFilterFactory"/>
  </analyzer>
</fieldtype>

Re: Solr suggest - How to define solr suggest as case insensitive

Posted by Mysurf Mail <st...@gmail.com>.
I have added it and it didnt work. Still returning different result to 1=C
and q=c


On Tue, Sep 10, 2013 at 1:52 AM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : This is probably because your dictionary is made up of all lower case
> tokens,
> : but when you query the spell-checker similar analysis doesnt happen.
> Ideal
> : case would be when you query the spellchecker you send lower case queries
>
> You can init the SpellCheckComponent with a "queryAnalyzerFieldType"
> option that will control what analysis happens.  ie...
>
>   <!-- This field type's analyzer is used by the QueryConverter to
> tokenize the value for "q" parameter -->
>   <str name="queryAnalyzerFieldType">phrase_suggest</str>
>
>
> ...it would be nice if this defaulted to using the fieldType of hte field
> you configure on the Suggester, but not all Impls are based on the index
> (you might be using an external dict file) so it has to be explicitly
> configured, and defaults to using a simple WhitespaceAnalyzer.
>
>
> -Hoss
>

Re: Solr suggest - How to define solr suggest as case insensitive

Posted by Chris Hostetter <ho...@fucit.org>.
: This is probably because your dictionary is made up of all lower case tokens,
: but when you query the spell-checker similar analysis doesnt happen. Ideal
: case would be when you query the spellchecker you send lower case queries

You can init the SpellCheckComponent with a "queryAnalyzerFieldType" 
option that will control what analysis happens.  ie...

  <!-- This field type's analyzer is used by the QueryConverter to tokenize the value for "q" parameter -->
  <str name="queryAnalyzerFieldType">phrase_suggest</str>


...it would be nice if this defaulted to using the fieldType of hte field 
you configure on the Suggester, but not all Impls are based on the index 
(you might be using an external dict file) so it has to be explicitly 
configured, and defaults to using a simple WhitespaceAnalyzer.


-Hoss

Re: Solr suggest - How to define solr suggest as case insensitive

Posted by "tamanjit.bindra@yahoo.co.in" <ta...@yahoo.co.in>.
This is probably because your dictionary is made up of all lower case tokens,
but when you query the spell-checker similar analysis doesnt happen. Ideal
case would be when you query the spellchecker you send lower case queries



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-suggest-How-to-define-solr-suggest-as-case-insensitive-tp4088764p4088918.html
Sent from the Solr - User mailing list archive at Nabble.com.