简体   繁体   English

Magento SOLR模糊搜索

[英]Magento SOLR fuzzy search

I am using SOLR search in magento and trying to use the power of SOLR fuzzy search. 我在magento中使用SOLR搜索,并尝试使用SOLR模糊搜索的功能。 But so far seems there is no luck. 但是到目前为止,似乎还没有运气。

I have tried using tilda (~) at the end of search query and also tried to using "PorterStemFilterFactory" which so far is the best stem factory that I know. 我尝试在搜索查询的末尾使用tilda(〜),也尝试使用“ PorterStemFilterFactory”,这是迄今为止我所知道的最好的词干工厂。 But it is not giving me any results. 但这并没有给我任何结果。 For example; 例如; I have products named "Shiraz". 我有名为“ Shiraz”的产品。 So a fuzzy search will return same results if search using "shirag" or "shrag". 因此,如果使用“ shirag”或“ shrag”进行搜索,模糊搜索将返回相同的结果。

This is my schema section (I am giving only the english section because that is the only part that I use) 这是我的模式部分(我只提供英语部分,因为这是我使用的唯一部分)

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
            <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="10" />
            <!--
                In this example, we will only use synonyms at query time.
                <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true"
                    expand="false"/>
            -->
            <!--
                Case insensitive stop word removal. Add enablePositionIncrements=true in both the index and query
                analyzers to leave a 'gap' for more accurate phrase queries.
            -->
            <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.SnowballPorterFilterFactory" language="English" protected="protwords_en.txt"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
            <filter class="solr.SynonymFilterFactory" synonyms="synonyms_en.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="0"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords_en.txt"/>
            <filter class="solr.PorterStemFilterFactory" />
        </analyzer>
    </fieldType>

Also these are the links I have tried: 这些也是我尝试过的链接:

http://johntwang.com/blog/2011/09/05/Fuzzy-and-Document-Searching-with-WebSolr-and-Heroku/ http://docs.lucidworks.com/display/solr/The+Standard+Query+Parser http://www.rqna.net/qna/mnuhwh-solr-fuzzy-search-for-similar-words.html http://johntwang.com/blog/2011/09/05/Fuzzy-and-Document-Searching-with-WebSolr-and-Heroku/ http://docs.lucidworks.com/display/solr/The+Standard+ Query + Parser http://www.rqna.net/qna/mnuhwh-solr-fuzzy-search-for-similar-words.html

See Solr Fuzzy Search for similar words and Solr/Lucene fuzzy search too slow 请参阅Solr模糊搜索以获取类似的单词,以及Solr / Lucene模糊搜索太慢

If you are looking for auto-suggest, then using the EdgeNGramFilter is definitely another option to consider. 如果您正在寻找自动建议,那么使用EdgeNGramFilter绝对是另一个可以考虑的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM