Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
Дата
Msg-id CAPpHfdsfdC5L0xQ2QwshevbGnoL+L6Ex5B2eJq7FhSzFUqWg2Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Ответы Re: Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug  (David Steele <david@pgmasters.net>)
Re: Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug  (David Steele <david@pgmasters.net>)
Список pgsql-bugs
On Wed, Dec 13, 2017 at 2:13 PM, Alexander Korotkov <a.korotkov@postgrespro.ru> wrote:
On Tue, Dec 12, 2017 at 2:33 PM, Teodor Sigaev <teodor@sigaev.ru> wrote:
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?
 
Good point.  Moved 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.

Yep.  I've introduced flags.

Also, I've adjusted tests to make them stable (found example where TOP-8 distances are unique).
Please, find revised patch in attachment.

I just found that patch apply is failed according to commitfest.cputube.org.  I think it's because I sent only second patch from patchset in last message.
Anyway I resend both patches rebased to current master.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 
Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #14999: pg_rewind corrupts control file global/pg_control
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #14999: pg_rewind corrupts control file global/pg_control