[Xapian-discuss] Query Spelling Dictionary

Olly Betts olly at survex.com
Fri Nov 15 20:21:42 GMT 2013


On Tue, Nov 12, 2013 at 10:20:11AM -0800, Eulogio Gallo wrote:
> Is there any way to see if a term is already in the spelling dictionary?

This should work (C++ version):

    Xapian::TermIterator i = db.spellings_begin();
    i.skip_to(word);
    if (i != db.spellings.end() && *i == word) {
        // Already in the dictionary.
    }

> Basically if I ask for a spelling suggestion for a term, e.g.
> 'clear', I will get the word 'clean' instead of not getting a
> suggestion at all.  I suspect this is because the word 'clean' has a
> higher frequency.  If I were able to check for 'clear' in the
> spelling dictionary, then I wouldn't have to deal with this issue.

You will currently be offered a suggestion if there's a more common
variant within the specified edit distance.  Probably such a variant
should need to be significantly more frequent to be offered.  This
ticket is related:

http://trac.xapian.org/ticket/225

Cheers,
    Olly



More information about the Xapian-discuss mailing list