X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fbookmark%2FBookmarkFileService.php;h=e3a611461a7aae9ecd3f0070a3341aa872aa737d;hb=a8e210faa624517ee8b8978b7e659a0b3c689297;hp=b3a90ed4623beecc7c75d96be635e33decfd6aed;hpb=d6e5f04d3987e498c5cb859eed6bff33d67949df;p=github%2Fshaarli%2FShaarli.git diff --git a/application/bookmark/BookmarkFileService.php b/application/bookmark/BookmarkFileService.php index b3a90ed4..e3a61146 100644 --- a/application/bookmark/BookmarkFileService.php +++ b/application/bookmark/BookmarkFileService.php @@ -114,8 +114,13 @@ class BookmarkFileService implements BookmarkServiceInterface /** * @inheritDoc */ - public function search($request = [], $visibility = null, $caseSensitive = false, $untaggedOnly = false) - { + public function search( + $request = [], + $visibility = null, + $caseSensitive = false, + $untaggedOnly = false, + bool $ignoreSticky = false + ) { if ($visibility === null) { $visibility = $this->isLoggedIn ? BookmarkFilter::$ALL : BookmarkFilter::$PUBLIC; } @@ -124,6 +129,10 @@ class BookmarkFileService implements BookmarkServiceInterface $searchtags = isset($request['searchtags']) ? $request['searchtags'] : ''; $searchterm = isset($request['searchterm']) ? $request['searchterm'] : ''; + if ($ignoreSticky) { + $this->bookmarks->reorder('DESC', true); + } + return $this->bookmarkFilter->filter( BookmarkFilter::$FILTER_TAG | BookmarkFilter::$FILTER_TEXT, [$searchtags, $searchterm],