Skip to content

Commit

Permalink
fix: recover page content like search
Browse files Browse the repository at this point in the history
  • Loading branch information
cnrpman authored and tiensonqin committed Nov 30, 2022
1 parent adf8d55 commit a3ee9e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/electron/electron/search.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
(when-let [database (get-db repo)]
(when-not (string/blank? q)
(let [match-inputs (get-match-inputs q)
non-match-input (str "%" (string/replace q #"\s+" "%") "%")
limit (or limit 20)
;; https://www.sqlite.org/fts5.html#the_highlight_function
;; the 2nd column in pages_fts (content)
Expand All @@ -316,6 +317,8 @@
select (str "select rowid, uuid, content, " snippet-aux " from pages_fts where ")
match-sql (str select
" content match ? order by rank limit ?")
non-match-sql (str select
" content like ? limit ?")
matched-result (->>
(map
(fn [match-input]
Expand Down

0 comments on commit a3ee9e5

Please sign in to comment.