Skip to content

Build your personal knowledge base with Trilium Notes

client/options/search: update min search query length

Adorian Doranb62133b380bc
diff --git a/apps/client/src/widgets/type_widgets/options/search_page.spec.tsx b/apps/client/src/widgets/type_widgets/options/search_page.spec.tsx
index 71a88d0bec..4493cd5843 100644
--- a/apps/client/src/widgets/type_widgets/options/search_page.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/options/search_page.spec.tsx
@@ -47,10 +47,11 @@ describe("hasSearchTerms", () => {
it("waits for a word worth looking for, whatever space is typed around it", () => {
expect(hasSearchTerms("")).toBe(false);
expect(hasSearchTerms(" ")).toBe(false);
- expect(hasSearchTerms("th")).toBe(false);
- expect(hasSearchTerms(" th ")).toBe(false);
+ expect(hasSearchTerms("t")).toBe(false);
+ expect(hasSearchTerms(" t ")).toBe(false);
- expect(hasSearchTerms("the")).toBe(true);
+ // Two letters is a name in its own right, which is what the AI page is found by.
+ expect(hasSearchTerms("ai")).toBe(true);
expect(hasSearchTerms(" theme ")).toBe(true);
});
});
diff --git a/apps/client/src/widgets/type_widgets/options/search_page.tsx b/apps/client/src/widgets/type_widgets/options/search_page.tsx
index 8f603458f4..7f860805cd 100644
--- a/apps/client/src/widgets/type_widgets/options/search_page.tsx
+++ b/apps/client/src/widgets/type_widgets/options/search_page.tsx
@@ -15,8 +15,11 @@ import { CONTENT_WIDGETS } from "../ContentWidget";
import type { TypeWidgetProps } from "../type_widget";
import OptionsPageHeader from "./components/OptionsPageHeader";
-/** How much has to be typed before there is enough of a word to look for. */
-export const MIN_QUERY_LENGTH = 3;
+/**
+ * How much has to be typed before there is enough of a word to look for. Two rather than three, so
+ * that a setting named by a pair of letters (AI) can be reached by typing it.
+ */
+export const MIN_QUERY_LENGTH = 2;
const DEBOUNCE_MS = 250;