fix: search-block-aux typo

pull/7540/head
Junyi Du 2022-11-30 13:29:27 +08:00 committed by Tienson Qin
parent e19fc7da04
commit 4c6bf7aced
1 changed files with 10 additions and 3 deletions

View File

@ -273,17 +273,23 @@
(->> (->>
(concat matched-result (concat matched-result
(search-blocks-aux database non-match-sql non-match-input page limit)) (search-blocks-aux database non-match-sql non-match-input page limit))
(distinct-by :id) (distinct-by :rowid)
(take limit) (take limit)
(vec)))))) (vec))))))
(defn- snippet-by
[content length]
(str (subs content 0 length) "..."))
(defn- search-pages-res-unpack (defn- search-pages-res-unpack
[arr] [arr]
(let [[rowid uuid content snippet] arr] (let [[rowid uuid content snippet] arr]
{:id rowid {:id rowid
:uuid uuid :uuid uuid
:content content :content content
:snippet snippet})) :snippet (if (string/includes? snippet "$pfts_2lqh>$ ")
snippet
(snippet-by snippet 250))}))
(defn- search-pages-aux (defn- search-pages-aux
[database sql input limit] [database sql input limit]
@ -317,7 +323,8 @@
match-inputs) match-inputs)
(apply concat))] (apply concat))]
(->> (->>
matched-result (concat matched-result
(search-pages-aux database non-match-sql non-match-input limit))
(distinct-by :id) (distinct-by :id)
(take limit) (take limit)
(vec)))))) (vec))))))