Cmd+Shift+K "Search only: current page" returns blocks from the whole graph

Đang mở Phù hợp với người mới
#1,506 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
clojure
Lĩnh vực
search

Hướng nghiên cứu

Bắt đầu tại src/main/frontend/components/cmdk/core.cljs, ở load-results :current-page, sau đó kiểm tra cách src/main/frontend/components/cmdk/state.cljs ánh xạ page-uuid và cách src/main/frontend/worker/search.cljs đọc giới hạn trang. Tái hiện bằng một từ có trong trang khác nhưng không có trong trang hiện tại. Hoàn tất khi “Search only: current page” không trả về khối nào từ các trang khác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Search first
  • I searched and no similar issues were found
What Happened?

With the "Search only: current page" filter (Cmd+Shift+K), results include blocks from other pages. The filter label is shown, but the search is not restricted to the current page.

Reproduce the Bug
  1. Open any page, e.g. page A.
  2. Press Cmd+Shift+K. The dialog shows "Search only: current page".
  3. Type a word that appears on other pages but not on page A.
  4. Blocks from other pages are listed as current-page results.
Expected Behavior

Only blocks of the current page are listed (no result in step 3).

Screenshots

No response

Files

No response

Browser, Desktop or Mobile Platform Information

macOS, Logseq desktop 2.0.2, DB graph

Additional Context

Likely cause (same code in 2.0.2 and master):

In load-results :current-page (src/main/frontend/components/cmdk/core.cljs), the page uuid is added to the options as :page-uuid:

opts (assoc opts :page-uuid current-page-uuid)

but search-blocks in src/main/frontend/worker/search.cljs only reads :page. The restriction is dropped and the whole graph is searched, then every result is rendered with :current-page? true.

cmdk-block-search-options (src/main/frontend/components/cmdk/state.cljs) already maps page-uuid to :page, but it is called before the uuid is resolved, so without it. Possible fix: (assoc opts :page (str current-page-uuid)), or resolve the uuid first and pass it to cmdk-block-search-options.

Are you willing to submit a PR? If you know how to fix the bug.
  • I'm willing to submit a PR (Thank you!)
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
29
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của logseq/db-test

Tất cả issue của logseq/db-test

Issue tương tự

Thêm issue về Search

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.