From 0bb72fbb266c8cd5c6ae570c1a2cdb7f8fb79c68 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 19 Jun 2022 23:04:10 +0300 Subject: [PATCH] experimental, af_psql_trgm: attempt to pseudo-normalize returned mysql score values by dividing by match length --- plugins/af_psql_trgm/init.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index 09a9fcd27..657b11934 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -86,7 +86,7 @@ class Af_Psql_Trgm extends Plugin { ttrss_entries.title AS title, updated, link, ttrss_feeds.title AS feed_title, - MATCH (ttrss_entries.title) AGAINST (:title) AS sm + (MATCH (ttrss_entries.title) AGAINST (:title) / LENGTH(ttrss_entries.title)) AS sm FROM ttrss_entries, ttrss_user_entries LEFT JOIN ttrss_feeds ON (ttrss_feeds.id = feed_id) WHERE @@ -343,7 +343,7 @@ class Af_Psql_Trgm extends Plugin { guid != :guid AND owner_uid = :uid"); } else { - $sth = $this->pdo->prepare("SELECT MATCH(title) AGAINST (:title) AS ms + $sth = $this->pdo->prepare("SELECT (MATCH(title) AGAINST (:title) / LENGTH(title)) AS ms FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id AND date_entered >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND guid != :guid AND