From 5300354848df3ad4ee26fc533f8394ee37015994 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 19 Apr 2011 15:41:44 +0400 Subject: [PATCH] fix searching by date; add search help prompt --- functions.php | 28 ++++++++++++++++++++++++++-- modules/popup-dialog.php | 11 +++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index 1401cd74..0da69094 100644 --- a/functions.php +++ b/functions.php @@ -3349,13 +3349,37 @@ $not = ""; } - if (strpos($k, "@") === 0) { + $commandpair = split(":", mb_strtolower($k), 2); + + if ($commandpair[0] == "note" && $commandpair[1]) { + + if ($commandpair[1] == "true") + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); + else + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); + + } else if ($commandpair[0] == "star" && $commandpair[1]) { + + if ($commandpair[1] == "true") + array_push($query_keywords, "($not (marked = true))"); + else + array_push($query_keywords, "($not (marked = false))"); + + } else if ($commandpair[0] == "pub" && $commandpair[1]) { + + if ($commandpair[1] == "true") + array_push($query_keywords, "($not (published = true))"); + else + array_push($query_keywords, "($not (published = false))"); + + } else if (strpos($k, "@") === 0) { $user_tz_string = get_pref($link, 'USER_TIMEZONE', $_SESSION['uid']); $orig_ts = strtotime(substr($k, 1)); - $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); + //$k = date("Y-m-d", strtotime(substr($k, 1))); + array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); } else if ($match_on == "both") { array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index 1f98edad..2eb63af9 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -421,8 +421,15 @@ print ""; - print "
- + print "
"; + + if (!SPHINX_ENABLED) { + print "
+ Search syntax +
"; + } + + print "
"; } -- 2.39.2