开发者

How to handle search term concatenations in SOLR

开发者 https://www.devze.com 2022-12-24 09:52 出处:网络
We are currently replacing our product search from mysql to a SOLR backend. Our customer often开发者_开发技巧 search for terms like \'startrek online\', \'starwars\', \'redsteel\' or even \'grandtheft

We are currently replacing our product search from mysql to a SOLR backend. Our customer often开发者_开发技巧 search for terms like 'startrek online', 'starwars', 'redsteel' or even 'grandtheftauto'. Is there a method in SOLR to either expand or spellcheck these searches into syllables eg.'star trek online', 'star wars', 'red steel', 'grand theft auto'?


You can use a synonym file. Take a look into this documenation site (solr.SynonymFilterFactory):

<fieldtype name="syn" class="solr.TextField">
  <analyzer>
      <tokenizer class="solr.WhitespaceTokenizerFactory"/>
      <filter class="solr.SynonymFilterFactory" synonyms="syn.txt" ignoreCase="true" expand="false"/>
  </analyzer>
</fieldtype>

For the searchquery splitting the WordDelimiterFilterFactory could match partially your needs, but maybe the synomymfilter is easier and better (+ probably faster).


You can try modifying your search terms using Levenshtein but also making use of SoundEx / Metaphone to improve matches.

http://web.elctech.com/2008/04/13/advanced-solr-filters-with-phonetics/

http://web.elctech.com/2009/07/06/solr-vs-sphinx-fuzzy-search/

0

精彩评论

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

关注公众号