diff options
| author | xuatz <xzlow10@gmail.com> | 2025-05-18 17:21:11 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-18 09:21:11 +0100 |
| commit | dbd0fd197323f2a83fab384d7b4b116a02165d16 (patch) | |
| tree | 2bd3c34bd7088b32ae7f0e33910d54b73a620366 /apps/web/lib | |
| parent | f338f7b102e538889e4f16fac407f4d5f17fdf69 (diff) | |
| download | karakeep-dbd0fd197323f2a83fab384d7b4b116a02165d16.tar.zst | |
fix(search): add new relevance sort order (#1392)
* fix(search): add new relevance sort order
* address pr comments
* some minor fixes
---------
Co-authored-by: Mohamed Bassem <me@mbassem.com>
Diffstat (limited to 'apps/web/lib')
| -rw-r--r-- | apps/web/lib/hooks/bookmark-search.ts | 9 | ||||
| -rw-r--r-- | apps/web/lib/i18n/locales/en/translation.json | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/web/lib/hooks/bookmark-search.ts b/apps/web/lib/hooks/bookmark-search.ts index 1bccd280..b6af94ee 100644 --- a/apps/web/lib/hooks/bookmark-search.ts +++ b/apps/web/lib/hooks/bookmark-search.ts @@ -6,6 +6,11 @@ import { keepPreviousData } from "@tanstack/react-query"; import { parseSearchQuery } from "@karakeep/shared/searchQueryParser"; +export function useIsSearchPage() { + const pathname = usePathname(); + return pathname.startsWith("/dashboard/search"); +} + function useSearchQuery() { const searchParams = useSearchParams(); const searchQuery = decodeURIComponent(searchParams.get("q") ?? ""); @@ -17,8 +22,8 @@ function useSearchQuery() { export function useDoBookmarkSearch() { const router = useRouter(); const { searchQuery, parsedSearchQuery } = useSearchQuery(); + const isInSearchPage = useIsSearchPage(); const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout | undefined>(); - const pathname = usePathname(); useEffect(() => { return () => { @@ -49,7 +54,7 @@ export function useDoBookmarkSearch() { debounceSearch, searchQuery, parsedSearchQuery, - isInSearchPage: pathname.startsWith("/dashboard/search"), + isInSearchPage, }; } diff --git a/apps/web/lib/i18n/locales/en/translation.json b/apps/web/lib/i18n/locales/en/translation.json index 42a904a4..aef2d2a7 100644 --- a/apps/web/lib/i18n/locales/en/translation.json +++ b/apps/web/lib/i18n/locales/en/translation.json @@ -79,6 +79,7 @@ "ignore": "Ignore", "sort": { "title": "Sort", + "relevant_first": "Most Relevant First", "newest_first": "Newest First", "oldest_first": "Oldest First" } |
