Did You Mean: Compass?
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.
February 28th, 2008 at 1:29 pm
Really cool. I was waiting for this little beauty’s availability
March 4th, 2008 at 2:03 am
Have a look at https://issues.apache.org/jira/browse/LUCENE-1190