5

I'm working on a site with the Search API Solr module.

I notice that, in fulltext searches, the system gives results only for entire word. If I've a title like "Beautiful", if I search "eautiful" it doesn't find something. Is there a way to solve this?

2

3 Answers 3

6

Set up Solr with the class EdgeNGramFilterFactory. This will not catch 'eautiful' instead of 'beautiful', but will give results on bea, beau, beaut and so on depending on minGramSize and maxGramSize. IMO this will be sufficient for most searches.

1
  • Another solution is to use Search Api Spellcheck
    – arrubiu
    Commented Sep 25, 2012 at 19:00
2

You could try adding 'beautiful' to the spelling suggestions for Solr. I believe there is a spellings.txt file in the Solr profile you are using for your site. It's probably in the apache-solr-1.4.1/example/solr/conf folder of your Solr installation. This is just from memory of setting this up several months ago, so the location could be wrong. The spelling suggestions will just notify the user that they may have misspelled a word and suggest what it thinks is the correct spelling. If you want to automatically search for the new spelling, you would probably have to write something yourself.

Some more details:

http://www.lucidimagination.com/blog/2010/08/31/getting-started-spell-checking-with-apache-lucene-and-solr/

http://wiki.apache.org/solr/SpellCheckComponent

2

Did you try fuzzy search project? It's maybe a good solution...If you write beaut he will match beautiful

As described in the documentation

Each word in a node is split into 3 (default) letter lengths, so 'apple' gets indexed with 3 smaller strings 'app', 'ppl', 'ple'. The effect of this is that as long as your search matches X percentage (administerable in the admin settings) of the word the node will be pulled up in the results.

I think i will implement this module in one week on a server test because my actual boss wants some result even if there are some mispellings.

1
  • I'm reading this module, but seems that it create another index on search_api..
    – arrubiu
    Commented Sep 26, 2012 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.