71 Commits

Author SHA1 Message Date
LaurentGH
a409fb5c1a
Ignore empty keywords in search queries (#277)
When user searches `something SPACE SPACE something`, there is an empty keyword between the two spaces, which has to be ignored.
This also ignores the case of empty queries between double quotes, such as `""` or `" "`, because PostgreSQL Full Text Search does not support them.
2026-03-10 19:52:45 -05:00
supahgreg
ca3174097d
Revert "sanitize content preview (#257)"
This reverts commit cc8380c04d11f1f4830776d42c3063d4ba534c75.
2026-02-11 12:20:56 +00:00
wltb
cc8380c04d
sanitize content preview (#257)
Co-authored-by: wltb <noreply@example.org>
2026-02-10 12:52:17 -06:00
Greg
2d4c8bdf25
Make the 'Recently read' max age configurable via preference (#236)
* Make the 'Recently read' max age configurable via preference.

Also: don't attempt to filter by unread articles when using the 'Unread' view mode in the 'Recently read' feed.

* Rebase translations.
2026-01-17 11:54:09 -06:00
LaurentGH
7c66135978
Display FeedParser error instead of the raw feed contents
When subscribing to a feed, if there is a FeedParser error, display the error message instead of the raw feed contents.
2025-12-09 11:22:54 +01:00
supahgreg
5770cc51ba
More ternary operator and ORM usage, assorted tweaks.
Among the 'assorted tweaks' is consistently converting a param to an array of integers.
2025-11-24 03:35:42 +00:00
LaurentGH
bbb075bdaa
Correctly support @yesterday search queries
As indicated in the current help page, searching a date keyword does not work as expected due to UTC comparison.

For example, if the current time is November 18th at 16:14 UTC, then in Japan (GMT+9), it's November 19th at 01:14. A Japanese user who searches for _@yesterday_ means November 18th. However the current implementation uses _strtotime()_ with a default timezone of UTC, so _strtotime("yesterday")_ returns November 17th (because it's still the 18th in UK). There is a time shift after, but it can't solve this first issue. Then, a second issue is related to the conversion of the _updated_ SQL column to a string "YYYY-MM-DD", but there is no time shift.

I choose to fully rewrite this code, using the modern PHP DateTime class, and to use a _true_ Unix timestamp range, instead of a shifted timestamp.
2025-11-20 17:59:45 +01:00
LaurentGH
833c4d279a
Add support for label:{true,false} and tag:{true:false} searches
A search query can now use _label:true_ to find articles with a label, whatever its name is.
A search query can now use _tag:true_ to find articles with a tag, whatever its name is.

This change is straightforward, because more complex queries about label/tag matching were already implemented.

By using two SQL fragments, there is no redundancy in the code.
2025-11-20 11:07:22 +01:00
LaurentGH
6b0c9cf0be
Fix search highlighting of sentences and operators
When a search is performed, the found text should be highlighted.

However:
- successive words are not highlighted because the SQL query with "<->" is used
- operators are highlighted
2025-11-19 08:51:11 +01:00
LaurentGH
f9343e8079
Support simple logical operators in search queries
tt-rss is currently supporting complex text search queries like _( one | two )_.

However, simple queries containing only _!_, _(_ or _)_ were not supported.

This is because the regexp only matched _&_ and _|_.
2025-11-18 12:00:22 +01:00
LaurentGH
fbf91a1f50
In title/author/note searches support spaces to match exact words
A search filter can for example contain spaces such as _title:" be "_.

In this case, the user as explicitly added spaces (instead of using _title:be_), so she clearly indicates her intent to search the word _be_, and not _cyBErspace_.

This patch supports these cases, for keywords title, author and notes.

Also, do a _mb_strtolower()_ globally, because it was in every keyword processing.

Also process the double quoting magic with a consistent regexp in the three needed cases. This change was needed because the previous regexp did not support leading spaces in the value part of a keyword pair.
2025-11-17 14:51:27 +01:00
LaurentGH
816a349d06
Fix a known search issue related to negative note keyword
When a user searches _-note:store_ the results now contains:
- articles with a note different of "store"
- articles with no notes

Indeed, the NULL case was not handled, so articles without a note were not displayed.
2025-11-17 11:28:16 +01:00
LaurentGH
98d7170e8c
Improve the coding style of _search_to_sql() 2025-11-16 18:22:01 +01:00
LaurentGH
638e28781a
Search the key of an invalid key pair as Full Text Search
A known issue was that the Search Query _title_ was searched using LIKE instead of Full Text Search. It was the same for all keys of an invalid key pair. Solving this suppresses a lot of redundant code.

The Search Queries _start:false_, _pub:false_ and _unread:false_ are now checked.

If the check fails, the SQL error message is bold/strong to be more visible.

The Search Query _@invalid-date_ is now also searched as Full Text Search. Unfortunately, there is no error message, but document it in the source code.
2025-11-16 14:46:57 +01:00
LaurentGH
7cd92c9ab3
The translation of Incorrect search syntax is not need
I tested with the English version, that's why the French message was not visible.

Comments are also simplified.
2025-11-15 14:28:48 +01:00
LaurentGH
2172326172
Fix bugs in _search_to_sql() and document limitations
The function _search_to_sql() processes the query string.

It contained a few bugs.

While analyzing it, I also added comments about the known limitations of this function.
2025-11-15 11:19:37 +01:00
supahgreg
5bec70065a
Assorted array-related (or nearby) tweaks.
Move away from 'array_push', simplify various things (e.g. eliminate low value intermediate vars), etc.
2025-11-01 23:47:00 +00:00
supahgreg
da5bb77dc1
Describe array shapes in some more places. 2025-11-01 04:12:20 +00:00
supahgreg
a8320ab9cf
Use first-class callable syntax.
Also tweak 'clean()' a bit in the process.

https://wiki.php.net/rfc/first_class_callable_syntax
2025-10-23 16:59:27 +00:00
supahgreg
fbac26467b
Various Rector rules for files that got missed previously.
Rules applied:
* ListToArrayDestructRector
* LongArrayToShortArrayRector
* ClassOnObjectRector
* ClassOnThisVariableObjectRector
* RemoveUnusedVariableInCatchRector
2025-10-18 02:05:57 +00:00
supahgreg
f9290ff37a
Rector rule 'ThisCallOnStaticMethodToStaticCallRector'.
https://getrector.com/rule-detail/this-call-on-static-method-to-static-call-rector
2025-10-18 01:48:51 +00:00
supahgreg
1da5a6ef1e
Rector rule 'TernaryToElvisRector'.
https://getrector.com/rule-detail/ternary-to-elvis-rector
2025-10-18 01:45:21 +00:00
supahgreg
6cf8f11b2b
Rector rule 'RemoveUnusedVariableInCatchRector'.
https://getrector.com/rule-detail/remove-unused-variable-in-catch-rector
2025-10-18 01:37:11 +00:00
supahgreg
c756a96b78
Rector rule 'NullCoalescingOperatorRector'.
https://getrector.com/rule-detail/null-coalescing-operator-rector
2025-10-18 01:30:04 +00:00
supahgreg
8480b14746
Rector rule 'LongArrayToShortArrayRector'.
https://getrector.com/rule-detail/long-array-to-short-array-rector
2025-10-18 01:24:59 +00:00
supahgreg
fbdf35d134
Rector rule 'ListToArrayDestructRector'.
https://getrector.com/rule-detail/list-to-array-destruct-rector
2025-10-18 01:20:32 +00:00
supahgreg
e1f34c982c
Stop using 'set_include_path', remove related PHPStan exclude. 2025-10-17 03:29:51 +00:00
supahgreg
e0b116f904
Bump PHPStan to 2.1.30 and address new findings.
Also some minor adjacent cleanup.
2025-10-05 20:51:13 +00:00
wn_
ecef0ae951 Tweak the 'Feeds::_get_title()' param order to make PHP happy.
Required params need to go before optional.
2025-08-29 12:28:05 +00:00
wn_
e5c5a1bf42 Make 'owner_uid' required for 'Feeds::_get_title()' and 'Feeds::_get_cat_title()'. 2025-08-29 12:19:04 +00:00
wn_
9aafc7bb8d Fix getting the title for syndicated feeds.
https://gitlab.tt-rss.org/tt-rss/tt-rss/-/merge_requests/181 missed that 'Feeds::_get_title()' gets invoked when headlines are generated for syndicated feeds.
2025-08-29 12:04:20 +00:00
wn_
9982871ac1 Filter more results by user ID. 2025-08-25 16:06:41 +00:00
Andrew Dolgov
bc312b1205
implement special counter display when viewing by published, similar to marked 2025-07-30 19:24:53 +03:00
wn_
0cd788220d Separate feed type detection from init, don't subscribe on failures.
Also some FeedParser tweaks.
2025-07-06 02:33:18 +00:00
Andrew Dolgov
12ef981bfb
allow searching by tags (prefix tag:) 2025-06-23 18:56:47 +03:00
wn_
09c11df764 Clean up displaying subscription error info, log more detailed info to the event log. 2025-06-19 20:37:49 +00:00
wn_
692c7a8949 Remove unused subscription return code 6 2025-06-17 18:02:57 +00:00
wn_
5b0d325733 Escape error content displayed when subscribing fails (as it might contain HTML). 2025-06-17 17:59:10 +00:00
wn_
ef1f3cbcef Show some HTML content as a hover tip when the 'feed URL' returned HTML without feeds.
Also tweak the 'Feeds::_subscribe()' documentation a bit.
2025-06-17 17:52:06 +00:00
wn_
2fa54cc627 Deprecate and remove use of the 'SUBSTRING_FOR_DATE' constant.
With MySQL support removed (b154bc7a10e46dc9fa0406996507c4fd410366da) this constant is unnecessary.
2025-05-18 14:26:05 +00:00
wn_
c472f00445 Get rid of 'Db::past_comparison_qpart()'.
With MySQL support dropped this function is just an unnecessary layer of abstraction.
2025-05-17 19:08:15 +00:00
Andrew Dolgov
b154bc7a10
initial attempt to remove mysql-related stuff from tt-rss 2025-04-14 12:59:00 +03:00
Andrew Dolgov
eedc1460e5
support transparent encryption for feed passwords, bump schema to drop length limit of ttrss_feeds.auth_pass 2025-04-08 09:36:04 +03:00
Andrew Dolgov
5dcb8db933
allow setting update interval in subcribe to feed dialog 2025-03-19 12:47:10 +03:00
wn_
434da183e7 Support using phrases in searches (PostgreSQL only). 2025-03-18 00:31:23 +00:00
wn_
4053af899f Some improvements in 'Feeds::_search_to_sql()'.
* Pass in the profile so some preferences can be retrieved correctly.
* Consistently use the owner UID that gets passed in (previously some session var uses).
2025-03-15 22:37:17 +00:00
wn_
89b0332d38 Add and use 'Db::now_comparison_qpart()'.
This introduces a helper to build a query part comparing a field against a past datetime (determined by '$now - $some_interval'), eliminating certain boilerplate code.
2025-03-04 18:34:35 +00:00
wn_
f9b2291c28 Don't bother passing unused arguments to 'TimeHelper::make_local_datetime()'.
There's no point in passing '$long' unless '$no_smart_dt' is set to 'true'.
2024-12-15 18:39:03 +00:00
wn_
119c7f13dc Consistently handle the 'smart' display of default/never dates. 2024-12-15 17:47:27 +00:00
wn_
667528d5b9 Use PHP 8 'str_' functions.
A few more characters in some places, but helps with readability.
2024-11-24 13:59:29 +00:00