diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index a66d50598d..0fd6f1ca2e 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -137,14 +137,15 @@ (rum/defc page-search-aux [id format embed? db-tag? q current-pos input pos] - (let [db? (config/db-based-graph? (state/get-current-repo)) + (let [db-based? (config/db-based-graph? (state/get-current-repo)) q (string/trim q) [matched-pages set-matched-pages!] (rum/use-state nil) search-f (fn [] (when-not (string/blank? q) (p/let [result (if db-tag? (editor-handler/get-matched-classes q) - (editor-handler/ alias: " (:block/title target)) - (:block/title block))) - (block-handler/block-unique-title block))] + (str (:block/title block') " -> alias: " (:block/title target)) + (:block/title block'))) + (block-handler/block-unique-title block'))] (search-handler/highlight-exact-query title q))]])) :empty-placeholder [:div.text-gray-500.text-sm.px-4.py-2 (if db-tag? "Search for a tag" "Search for a node")] :class "black"}) - (when (and db? db-tag? (not (string/blank? q))) + (when (and db-based? db-tag? (not (string/blank? q))) [:p.px-1.opacity-50.text-sm [:code (if util/mac? "Cmd+Enter" "Ctrl+Enter")] [:span " to display this tag inline instead of at the end of this node."]])]))) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 54d4525e71..80bc46d173 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -1750,10 +1750,11 @@ (defn (concat matched (when nlp-pages? diff --git a/src/main/frontend/worker/search.cljs b/src/main/frontend/worker/search.cljs index 8887434b4d..e65f7c6465 100644 --- a/src/main/frontend/worker/search.cljs +++ b/src/main/frontend/worker/search.cljs @@ -272,7 +272,7 @@ DROP TRIGGER IF EXISTS blocks_au; * :limit - Number of result to limit search results. Defaults to 100 * :dev? - Allow all nodes to be seen for development. Defaults to false * :built-in? - Whether to return public built-in nodes for db graphs. Defaults to false" - [repo conn search-db q {:keys [limit page enable-snippet? built-in? dev?] + [repo conn search-db q {:keys [limit page enable-snippet? built-in? dev? page-only?] :as option :or {enable-snippet? true}}] (when-not (string/blank? q) @@ -295,7 +295,8 @@ DROP TRIGGER IF EXISTS blocks_au; (str select pg-sql " title match ? or title match ? order by rank limit ?") (str select pg-sql " title match ? order by rank limit ?")) non-match-sql (str select pg-sql " title like ? limit ?") - matched-result (search-blocks-aux search-db match-sql q match-input page limit enable-snippet?) + matched-result (when-not page-only? + (search-blocks-aux search-db match-sql q match-input page limit enable-snippet?)) non-match-result (when non-match-input (search-blocks-aux search-db non-match-sql q non-match-input page limit enable-snippet?)) ;; fuzzy is too slow for large graphs