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

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Jan Przemysław Wójcik <jan(dot)przemyslaw(dot)wojcik(at)gmail(dot)com>, Postgres-Bugs <pgsql-bugs(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
Date: 2017-12-12 11:33:47
Message-ID: 42a3a2a4-59b9-c932-3bdf-e346e7b2e406@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> 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(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Teodor Sigaev 2017-12-12 12:33:15 Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
Previous Message Teodor Sigaev 2017-12-12 11:21:06 Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug

Browse pgsql-hackers by date

  From Date Subject
Next Message Beena Emerson 2017-12-12 11:34:26 Re: [HACKERS] Runtime Partition Pruning
Previous Message Beena Emerson 2017-12-12 11:33:29 Re: [HACKERS] Runtime Partition Pruning