mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-12-02 21:39:11 -05:00
Shared queries: combine user search structurally (#9544)
Follow-up to #9541. In `p/api/query.php`, the optional `search` parameter of a shared user query was appended as a string to the user query's own search, and the result was parsed again. This keeps both searches as parsed objects and combines them with a structural AND via `FreshRSS_BooleanSearch::add()`, avoiding the serialise/re-parse round trip. Adds a test for combining Boolean searches with `add()`.
This commit is contained in:
1 parent
669997ecbe
commit
931a6b3bbd
2 files changed
+22
-9
No files matched your search
@@ -757,6 +757,15 @@ final class SearchTest extends \PHPUnit\Framework\TestCase {
|
||||
self::assertSame('(e.id >= ?) OR (e.`lastModified` >= ?)', $filterSearch);
|
||||
self::assertSame([$startTime . '000000', $startTime], $filterValues);
|
||||
}
|
||||
public function test__add_boolean_searches_combines_with_and(): void {
|
||||
$combined = new FreshRSS_BooleanSearch('');
|
||||
$combined->add(new FreshRSS_BooleanSearch('ab'));
|
||||
$combined->add(new FreshRSS_BooleanSearch('cd OR ef', 0, 'AND', allowUserQueries: false));
|
||||
self::assertSame('ab (cd OR ef)', $combined->toString());
|
||||
|
||||
[$filterValues] = FreshRSS_EntryDAOPGSQL::sqlBooleanSearch('e.', $combined);
|
||||
self::assertSame(['%ab%', '%ab%', '%cd%', '%cd%', '%ef%', '%ef%'], $filterValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string> $values
|
||||
|
||||
Reference in new issue
Block a user