You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by Valentin <vs...@free.fr> on 2011/08/10 18:25:10 UTC

SolR : Spellchecking & Autocomplete

Hello,

*## __First question :__ ##*

I have *2 handlers* : one for autocompletion, and one for spellchecking.
They are working very well but i want them to be in the *same handler* (the
default one).

I can add one of them to the default handler with :

    <requestHandler name="standard" class="solr.StandardRequestHandler"
default="true">
        <lst name="defaults">
            <str name="spellcheck">true</str>
            <str name="spellcheck.dictionary">suggest</str>
            <str name="spellcheck.count">10</str>
            <str name="spellcheck.onlyMorePopular">true</str>

            ....(stuff for the main request)....

        </lst>
        <arr name="last-components">
            <str>suggest</str>
        </arr>
    </requestHandler>

But i can't do this twice like this :

    <requestHandler name="standard" class="solr.StandardRequestHandler"
default="true">
        <lst name="defaults">
            <str name="spellcheck">true</str>
            <str name="spellcheck.dictionary">suggest</str>
            <str name="spellcheck.count">10</str>
            <str name="spellcheck.onlyMorePopular">true</str>

            ....(stuff for the main request)....

        </lst>
        <arr name="last-components">
            <str>suggest</str>
            <str>spellcheck</str>
        </arr>
    </requestHandler>

Because the spellchecker needs the line :

    <str name="spellcheck.dictionary">spellcheck</str>
wich is already in the handler, but with the dictionnary for the
autocomplete. So how can i do to add both of them to the main handler ?  

*## __Second question :__ ##*

If i type "Britny", i want the suggestion "Britney Spears", wich is
spellchecked *and* autocompleted. How can I do that ? Yet, can just do
spellcheck OR autocomplete...


*## __Third question :__ ##*

Why If i type "britne" it autocompletes "britney", but when i type " Britne"
it doesn't find any result ? Here is my field for autocomplete :

    <fieldType name="suggestText" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
ignoreCase="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt" ignoreCase="true"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"
ignoreCase="true"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="0"
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"
ignoreCase="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt" ignoreCase="true"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"
ignoreCase="true"/>
      </analyzer>
    </fieldType>

It has the LowerCaseFilterFactory in the query part AND in the index part,
so I guessed it will convert my query to lowerCase and compare withe the
words stored in lowercase, but obviously not.

Moreover, I would like to have when I type "Britne", "britne" or "BriTnE"
the result "Britney" (and not "britney"). How can I make my
autocompleter/spellchecker *not case-sensitive* ?

--
View this message in context: http://lucene.472066.n3.nabble.com/SolR-Spellchecking-Autocomplete-tp3243107p3243107.html
Sent from the Lucene - General mailing list archive at Nabble.com.

Re: SolR : Spellchecking & Autocomplete

Posted by Grant Ingersoll <gs...@apache.org>.
You might try asking on solr-user@lucene.apache.org.  It has a much larger subscription base than this list.

On Aug 10, 2011, at 12:25 PM, Valentin wrote:

> Hello,
> 
> *## __First question :__ ##*
> 
> I have *2 handlers* : one for autocompletion, and one for spellchecking.
> They are working very well but i want them to be in the *same handler* (the
> default one).
> 
> I can add one of them to the default handler with :
> 
>    <requestHandler name="standard" class="solr.StandardRequestHandler"
> default="true">
>        <lst name="defaults">
>            <str name="spellcheck">true</str>
>            <str name="spellcheck.dictionary">suggest</str>
>            <str name="spellcheck.count">10</str>
>            <str name="spellcheck.onlyMorePopular">true</str>
> 
>            ....(stuff for the main request)....
> 
>        </lst>
>        <arr name="last-components">
>            <str>suggest</str>
>        </arr>
>    </requestHandler>
> 
> But i can't do this twice like this :
> 
>    <requestHandler name="standard" class="solr.StandardRequestHandler"
> default="true">
>        <lst name="defaults">
>            <str name="spellcheck">true</str>
>            <str name="spellcheck.dictionary">suggest</str>
>            <str name="spellcheck.count">10</str>
>            <str name="spellcheck.onlyMorePopular">true</str>
> 
>            ....(stuff for the main request)....
> 
>        </lst>
>        <arr name="last-components">
>            <str>suggest</str>
>            <str>spellcheck</str>
>        </arr>
>    </requestHandler>
> 
> Because the spellchecker needs the line :
> 
>    <str name="spellcheck.dictionary">spellcheck</str>
> wich is already in the handler, but with the dictionnary for the
> autocomplete. So how can i do to add both of them to the main handler ?  
> 
> *## __Second question :__ ##*
> 
> If i type "Britny", i want the suggestion "Britney Spears", wich is
> spellchecked *and* autocompleted. How can I do that ? Yet, can just do
> spellcheck OR autocomplete...
> 
> 
> *## __Third question :__ ##*
> 
> Why If i type "britne" it autocompletes "britney", but when i type " Britne"
> it doesn't find any result ? Here is my field for autocomplete :
> 
>    <fieldType name="suggestText" class="solr.TextField"
> positionIncrementGap="100">
>      <analyzer type="index">
>        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>        <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt"/>
>        <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="1"
> catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
> ignoreCase="true"/>
>        <filter class="solr.LowerCaseFilterFactory"/>
>        <filter class="solr.KeywordMarkerFilterFactory"
> protected="protwords.txt" ignoreCase="true"/>
>        <filter class="solr.RemoveDuplicatesTokenFilterFactory"
> ignoreCase="true"/>
>      </analyzer>
>      <analyzer type="query">
>        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>        <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt"/>
>        <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="0"
> catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"
> ignoreCase="true"/>
>        <filter class="solr.LowerCaseFilterFactory"/>
>        <filter class="solr.KeywordMarkerFilterFactory"
> protected="protwords.txt" ignoreCase="true"/>
>        <filter class="solr.RemoveDuplicatesTokenFilterFactory"
> ignoreCase="true"/>
>      </analyzer>
>    </fieldType>
> 
> It has the LowerCaseFilterFactory in the query part AND in the index part,
> so I guessed it will convert my query to lowerCase and compare withe the
> words stored in lowercase, but obviously not.
> 
> Moreover, I would like to have when I type "Britne", "britne" or "BriTnE"
> the result "Britney" (and not "britney"). How can I make my
> autocompleter/spellchecker *not case-sensitive* ?
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/SolR-Spellchecking-Autocomplete-tp3243107p3243107.html
> Sent from the Lucene - General mailing list archive at Nabble.com.

--------------------------------------------
Grant Ingersoll