Ver Fonte

fix: current page

Tienson Qin há 1 ano atrás
pai
commit
1d5a8b5c27

+ 1 - 1
e2e-tests/page-search.spec.ts

@@ -40,7 +40,7 @@ test('Search page and blocks (diacritics)', async ({ page, block }) => {
 
   // check if diacritics are indexed
   const results = await searchPage(page, 'Einführung in die Allgemeine Sprachwissenschaft' + rand)
-  await expect(results.length).toEqual(6) // 1 page + 2 block + 2 page content + 1 current page
+  await expect(results.length).toEqual(6) //  2 block + 1 current page
   await closeSearchBox(page)
 })
 

+ 1 - 1
src/main/frontend/db_worker.cljs

@@ -138,7 +138,7 @@
             _ (when (zero? capacity)   ; file handle already releases since pool will be initialized only once
                 (.acquireAccessHandles pool))
             db (new (.-OpfsSAHPoolDb pool) repo-path)
-            search-db (new (.-OpfsSAHPoolDb pool) (str "search-" repo-path))
+            search-db (new (.-OpfsSAHPoolDb pool) (str "search" repo-path))
             storage (new-sqlite-storage repo {})]
       (swap! *sqlite-conns assoc repo {:db db
                                        :search search-db})

+ 2 - 2
src/main/frontend/worker/search.cljs

@@ -17,7 +17,7 @@
 (defn- add-blocks-fts-triggers!
   "Table bindings of blocks tables and the blocks FTS virtual tables"
   [db]
-  (let [triggers [;; add
+  (let [triggers [;; delete
                   "CREATE TRIGGER IF NOT EXISTS blocks_ad AFTER DELETE ON blocks
                   BEGIN
                       DELETE from blocks_fts where id = old.id;
@@ -157,7 +157,7 @@
             matched-result (search-blocks-aux db match-sql match-input page limit)
             non-match-result (search-blocks-aux db non-match-sql non-match-input page limit)
             all-result (->> (concat matched-result non-match-result)
-                            (map (fn [[id _content page snippet]]
+                            (map (fn [[id page _content snippet]]
                                    {:uuid id
                                     :content snippet
                                     :page page})))]