1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

GUC variable pg_trgm.similarity_threshold insead of set_limit()

Use GUC variable pg_trgm.similarity_threshold insead of
set_limit()/show_limit() which was introduced when defining GUC varuables
by modules was absent.

Author: Artur Zakirov
This commit is contained in:
Teodor Sigaev
2016-03-16 17:44:58 +03:00
parent f9e5ed61ed
commit 5871b88487
6 changed files with 78 additions and 15 deletions

View File

@ -206,7 +206,9 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
* similarity is just c / len1.
* So, independly on DIVUNION the upper bound formula is the same.
*/
res = (nkeys == 0) ? false : ((((((float4) ntrue) / ((float4) nkeys))) >= trgm_limit) ? true : false);
res = (nkeys == 0) ? false :
((((((float4) ntrue) / ((float4) nkeys))) >= similarity_threshold)
? true : false);
break;
case ILikeStrategyNumber:
#ifndef IGNORECASE
@ -283,7 +285,9 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
/*
* See comment in gin_trgm_consistent() about * upper bound formula
*/
res = (nkeys == 0) ? GIN_FALSE : (((((float4) ntrue) / ((float4) nkeys)) >= trgm_limit) ? GIN_MAYBE : GIN_FALSE);
res = (nkeys == 0) ? GIN_FALSE :
(((((float4) ntrue) / ((float4) nkeys)) >= similarity_threshold)
? GIN_MAYBE : GIN_FALSE);
break;
case ILikeStrategyNumber:
#ifndef IGNORECASE