Supporse I have the fllowing table with words from a dictionary:
Word
---
cat
dog
giraffe
zebra
I would like to find a word, and if it doesn't exist, the closest before it in dictionary order, e.g. aardvark would return nothing, cat would return cat, cow would return cat, horse would return giraffe.
This should be relatively straightforward to search for using a BTREE index but I haven't figured out a way to do it. I'm using sqlite for this, but other engines are also acceptable.
I'm only interested in the dictionary order, i.e. the query should work exactly with the above examples. Other similarity metrics are of course nice, but are irrelevant to this question.
Aucun commentaire:
Enregistrer un commentaire