From: Andrew Dolgov Date: Tue, 19 Apr 2011 11:41:44 +0000 (+0400) Subject: fix searching by date; add search help prompt X-Git-Tag: 1.5.3~22 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5300354848df3ad4ee26fc533f8394ee37015994;p=tt-rss.git fix searching by date; add search help prompt --- 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 "
"; }