summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-06-19 23:04:10 +0300
committerAndrew Dolgov <[email protected]>2022-06-19 23:04:10 +0300
commit0bb72fbb266c8cd5c6ae570c1a2cdb7f8fb79c68 (patch)
tree32dc1cb5f23145d46569446864ec4e60d55303cc
parent50f014e52d0f90c71a95576c2414804eeaef131d (diff)
experimental, af_psql_trgm: attempt to pseudo-normalize returned mysql score values by dividing by match length
-rw-r--r--plugins/af_psql_trgm/init.php4
1 files 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