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

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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: 2018-01-04 21:25:52
Message-ID: CAPpHfdsfdC5L0xQ2QwshevbGnoL+L6Ex5B2eJq7FhSzFUqWg2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Dec 13, 2017 at 2:13 PM, Alexander Korotkov <
a(dot)korotkov(at)postgrespro(dot)ru> wrote:

> On Tue, Dec 12, 2017 at 2:33 PM, Teodor Sigaev <teodor(at)sigaev(dot)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

Attachment Content-Type Size
0001-pg-trgm-word-similarity-docs-improvement-3.patch application/octet-stream 4.2 KB
0002-pg-trgm-strict_word-similarity-3.patch application/octet-stream 87.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-01-05 01:26:37 Re: BUG #14999: pg_rewind corrupts control file global/pg_control
Previous Message PG Bug reporting form 2018-01-04 20:06:33 BUG #14999: pg_rewind corrupts control file global/pg_control

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-01-04 21:26:58 Re: Finalizing logical replication limitations as well as potential features
Previous Message Tom Lane 2018-01-04 21:17:06 Re: [JDBC] [HACKERS] Channel binding support for SCRAM-SHA-256