Did You Mean: Compass?
2008 February 27
Just finished adding support for spell checking in Compass (available in the nightly builds) which turned out a really cool and easy to use feature. In order to enable spell check in Compass, all that needs to be done is set the following property:
1 | compass.engine.spellcheck.enable=true |
Next, in the code that performs the search, the following can be done:
1 2 3 4 5 6 | CompassQuery query = session.queryBuilder().queryString("fiv").toQuery(); CompassHits hits = query.hits(); System.out.println("Original Query: " + hits.getQuery()); if (hits.getSuggestedQuery().isSuggested()) { System.out.println("Did You Mean: " + hits.getSuggestedQuery()); } |
Naturally, there are many ways to configure and control this feature, which are all explained in the reference docs, but this is the gist of it.



My name is Shay Banon, the founder of 
Really cool. I was waiting for this little beauty’s availability
Have a look at https://issues.apache.org/jira/browse/LUCENE-1190
Kimchy, it works well with english words but fails with russian. Could you give some explanations or suggestions to use it with languages other than english?
Hi Shay ,
Thanks for posting and creating such a nice api… I am using compass in Google app engine, and followed your other blog, and you know it worked perfectly… Thanks a lot… I tested application in production (http://go.simplyshareit.com/index.jsf ) and it is working perfectly…
I wanted to add this spelling feature also, but don’t know how to set this property in PMF file you wrote…
Can you help me on this.. Thanks a lot…
Amit
Hi,
I found the solution using and it is working
.setSetting(”compass.engine.spellcheck.enable”,”true”)
Thanks