开发者

why does Solr not return any result on "suits" when there is a document that containing the word "Suits"

开发者 https://www.devze.com 2023-03-21 19:24 出处:网络
I have a little problem with my Solr search engine. It does not return any result when I search on the word \"suits\". I\'m 100% sure that it exists a document that are containing the word \"Suits\".

I have a little problem with my Solr search engine. It does not return any result when I search on the word "suits". I'm 100% sure that it exists a document that are containing the word "Suits". I can however search for the word "suit" and the result containing "suits" ends up.

My schema:

<schema name="hello" version="1.3">
    <types>
        <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
            <analyzer type="index">
                <tokenizer class="solr.WhitespaceTokenizerFactory"/>
                <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"/>
                &l开发者_如何学Ct;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>
    </types>
    <fields>
        <field name="id" type="string" indexed="true" stored="true" required="true" />
        <field name="title" type="text" indexed="true" stored="true" required="true"/>
        <field name="description" type="text" indexed="true" stored="true" required="true"/>
        <field name="profileMiniature" type="string" stored="true" required="true"/>
    </fields>
    <uniqueKey>id</uniqueKey>
    <defaultSearchField>title</defaultSearchField>
</schema>

my query is "title:$q*^2 description:$q*".


A search with wildcards disables the analysis (as described here).

To match suit with suits, you need stemming and not wildcards. Using wildcards will anyway not work if your data has suit and the query is suits.

Could you provide some more information - maybe a use-case which explains why you need wildcards? It will help us come up with a better solution to your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号