af_psql_trgm: enable checking for similar articles in the source feed as long as guid is different

This commit is contained in:
Andrew Dolgov 2015-07-15 13:15:00 +03:00
parent a950fbecb5
commit 9264ec7055
1 changed files with 3 additions and 3 deletions

View File

@ -270,7 +270,7 @@ class Af_Psql_Trgm extends Plugin {
$owner_uid = $article["owner_uid"]; $owner_uid = $article["owner_uid"];
$feed_id = $article["feed"]["id"]; $entry_guid = $article["guid_hashed"];
$title_escaped = db_escape_string($article["title"]); $title_escaped = db_escape_string($article["title"]);
// trgm does not return similarity=1 for completely equal strings // trgm does not return similarity=1 for completely equal strings
@ -279,7 +279,7 @@ class Af_Psql_Trgm extends Plugin {
FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id AND FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id AND
date_entered >= NOW() - interval '1 day' AND date_entered >= NOW() - interval '1 day' AND
title = '$title_escaped' AND title = '$title_escaped' AND
feed_id != '$feed_id' AND guid != '$entry_guid' AND
owner_uid = $owner_uid"); owner_uid = $owner_uid");
$nequal = db_fetch_result($result, 0, "nequal"); $nequal = db_fetch_result($result, 0, "nequal");
@ -293,7 +293,7 @@ class Af_Psql_Trgm extends Plugin {
$result = db_query("SELECT MAX(SIMILARITY(title, '$title_escaped')) AS ms $result = db_query("SELECT MAX(SIMILARITY(title, '$title_escaped')) AS ms
FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id AND FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id AND
date_entered >= NOW() - interval '1 day' AND date_entered >= NOW() - interval '1 day' AND
feed_id != '$feed_id' AND guid != '$entry_guid' AND
owner_uid = $owner_uid"); owner_uid = $owner_uid");
$similarity_result = db_fetch_result($result, 0, "ms"); $similarity_result = db_fetch_result($result, 0, "ms");