|
|
|
@ -282,17 +282,10 @@
|
|
|
|
|
|
|
|
|
|
function search_to_sql($search) {
|
|
|
|
|
|
|
|
|
|
/*if (DB_TYPE == "pgsql") {
|
|
|
|
|
$search_escaped = db_escape_string($search);
|
|
|
|
|
|
|
|
|
|
return array("(to_tsvector('english', SUBSTR(ttrss_entries.title, 0, 200) || ' ' || SUBSTR(content, 0, 800))
|
|
|
|
|
@@ to_tsquery('$search_escaped'))", explode(" ", $search));
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
$keywords = str_getcsv($search, " ");
|
|
|
|
|
$query_keywords = array();
|
|
|
|
|
$search_words = array();
|
|
|
|
|
$search_query_leftover = "";
|
|
|
|
|
$search_query_leftover = array();
|
|
|
|
|
|
|
|
|
|
foreach ($keywords as $k) {
|
|
|
|
|
if (strpos($k, "-") === 0) {
|
|
|
|
@ -390,23 +383,27 @@
|
|
|
|
|
|
|
|
|
|
array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')");
|
|
|
|
|
} else {
|
|
|
|
|
$search_query_leftover .= $k . " ";
|
|
|
|
|
|
|
|
|
|
if (!$not) array_push($search_words, $k);
|
|
|
|
|
|
|
|
|
|
/*array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
|
|
|
|
|
if (DB_TYPE == "pgsql") {
|
|
|
|
|
$k = mb_strtolower($k);
|
|
|
|
|
array_push($search_query_leftover, $not ? "!$k" : $k);
|
|
|
|
|
} else {
|
|
|
|
|
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
|
|
|
|
|
OR UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))");
|
|
|
|
|
if (!$not) array_push($search_words, $k);*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$not) array_push($search_words, $k);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($search_query_leftover) {
|
|
|
|
|
$search_query_leftover = db_escape_string($search_query_leftover);
|
|
|
|
|
if (count($search_query_leftover) > 0) {
|
|
|
|
|
$search_query_leftover = db_escape_string(implode(" & ", $search_query_leftover));
|
|
|
|
|
|
|
|
|
|
if (DB_TYPE == "pgsql") {
|
|
|
|
|
array_push($query_keywords,
|
|
|
|
|
"(to_tsvector('simple', SUBSTR(ttrss_entries.title, 0, 200) || ' ' || SUBSTR(content, 0, 800))
|
|
|
|
|
@@ to_tsquery('$search_query_leftover'))");
|
|
|
|
|
"(tsvector_combined @@ '$search_query_leftover'::tsquery)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -713,6 +710,7 @@
|
|
|
|
|
if ($feed == -3)
|
|
|
|
|
$first_id_query_strategy_part = "true";
|
|
|
|
|
|
|
|
|
|
if (!$search) {
|
|
|
|
|
// if previous topmost article id changed that means our current pagination is no longer valid
|
|
|
|
|
$query = "SELECT DISTINCT
|
|
|
|
|
ttrss_feeds.title,
|
|
|
|
@ -749,6 +747,7 @@
|
|
|
|
|
return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words, $first_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$query = "SELECT DISTINCT
|
|
|
|
|
date_entered,
|
|
|
|
|