pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Teodor Sigaev <teodor@sigaev.ru>
To: Alexander Korotkov <a.korotkov@postgrespro.ru>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Jan Przemysław Wójcik <jan.przemyslaw.wojcik@gmail.com>
Cc: Postgres-Bugs <pgsql-bugs@postgresql.org>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
Date: Tue, 12 Dec 2017 14:33:47 +0300
Message-ID: <42a3a2a4-59b9-c932-3bdf-e346e7b2e406@sigaev.ru> (raw )
In-Reply-To: <CAPpHfdtXJp0xvi8QbcHWqnrk=XyyMux4FtbJCgZFPknPbLERVA@mail.gmail.com >
References: <CY4PR17MB13207ED8310F847CF117EED0D85A0@CY4PR17MB1320.namprd17.prod.outlook.com >
<20171028082225.GA2157@arthur.localdomain >
<CAPpHfdtz4a9dTxp-Fpem8uBdSBuOQV_i2xuFyL1tG6zM6nAkpg@mail.gmail.com >
<CA+YsLFp9scUNjjfYJC=84V9o-ZB66GWPq3e_Jveqs1bNejA4qA@mail.gmail.com >
<CAPpHfdsDtQJ+pYfapH7GMt9n4RLByKMzHEBWcPL99C_g+rkUKQ@mail.gmail.com >
<1510059095836-0.post@n3.nabble.com >
<CA+Tgmobksqi+Kh2=NZarEhnSUAudY=3oc+K8HjqSRvytbw7cnQ@mail.gmail.com >
<CAPpHfduRG6pXz8RC5TLppV7cpWeNPn0_4nNzX-nT4T6bb6_Y+Q@mail.gmail.com >
<CAPpHfdtXJp0xvi8QbcHWqnrk=XyyMux4FtbJCgZFPknPbLERVA@mail.gmail.com >
> 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/
view thread (28+ messages) latest in thread
Message-ID: <42a3a2a4-59b9-c932-3bdf-e346e7b2e406@sigaev.ru>
Permalink: ../42a3a2a4-59b9-c932-3bdf-e346e7b2e406@sigaev.ru/
Also on: postgresql.org/message-id/42a3a2a4-59b9-c932-3bdf-e346e7b2e406@sigaev.ru
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: teodor@sigaev.ru, a.korotkov@postgrespro.ru, robertmhaas@gmail.com, jan.przemyslaw.wojcik@gmail.com, pgsql-bugs@postgresql.org
Subject: Re: Fwd: [BUGS] pg_trgm word_similarity inconsistencies or bug
In-Reply-To: <42a3a2a4-59b9-c932-3bdf-e346e7b2e406@sigaev.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox