Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
| От | Teodor Sigaev |
|---|---|
| Тема | Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug |
| Дата | |
| Msg-id | 42a3a2a4-59b9-c932-3bdf-e346e7b2e406@sigaev.ru обсуждение исходный текст |
| Ответ на | Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug (Alexander Korotkov <a.korotkov@postgrespro.ru>) |
| Ответы |
Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug |
| Список | pgsql-bugs |
> 0002-pg-trgm-strict_word-similarity.patch – implementation of
> strict_word_similarity() with comments, docs and tests.
After some looking in
1)
repeated piece of code:
+ if (strategy == SimilarityStrategyNumber)
+ nlimit = similarity_threshold;
+ else if (strategy == WordSimilarityStrategyNumber)
+ nlimit = word_similarity_threshold;
+ else /* strategy == StrictWordSimilarityStrategyNumber */
+ nlimit = strict_word_similarity_threshold;
Isn't it better to move that piece to separate function?
2)
calc_word_similarity(char *str1, int slen1, char *str2, int slen2,
bool check_only, bool word_bounds)
Seems, two bools args are replaceble to bitwise-ORed flag. It will simplify
adding new options in future.
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/
В списке pgsql-bugs по дате отправления: