I'm trying to create an application which uses trigrams for approximate string matching. Now all the records are in the database and i want to be able to search the records on a fixed column. Is it best to have an additional field whihc contains the hashed version of the value i want to search (if so, whats the best way to store it?) or is it better to generate t开发者_StackOverflow社区he trigrams on the fly?
Which database are you using?
PostgreSQL has trigram functions built in which work off of GiST or GiN indexes.
In SQL, I'm using CLR to create and compare trigram sets, works much, much faster than SQL code.
精彩评论