[Bug]: SEOFilter drops keywords and weights in dump()/load()

Đang mở
#2,441 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Siddharth-DWT đang làm issue này rồi.

Từ ngày 24/10/2026.

  • #2442 của @Siddharth-DWT — đang mở

Đá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
38/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ệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Start with SEOFilter in crawl4ai/deep_crawling/filters.py and compare its serialization with the deep-crawl filters fixed in #2425. Reproduce the loss using the snippet in the issue, then check to_serializable_dict() and CrawlerRunConfig.dump()/load(). Done means keywords and custom weights survive a round trip and the loaded filter scores pages with them.

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

Mô tả

⚙️ In-progress 🐞 Bug
crawl4ai version

0.9.5 (also on develop)

Expected Behavior

SEOFilter keeps keywords and weights through to_serializable_dict() / CrawlerRunConfig.dump() and load(), like the other deep-crawl filters after #2425.

Current Behavior

SEOFilter compiles its keywords into a regex and keeps only the pattern (_kw_patterns), and keeps weights in a private slot, so both are dropped when serialized:

SEOFilter(threshold=0.5, keywords=["python"], weights={"title_kw": 1.0})
-> {'type': 'SEOFilter', 'params': {'threshold': 0.5}}

A loaded filter then scores pages with no keywords and the default weights.

Is this reproducible?

Yes

Inputs Causing the Bug

Any SEOFilter with keywords or weights.

Steps to Reproduce

Run the snippet below.

Code snippets
from crawl4ai.async_configs import to_serializable_dict
from crawl4ai.deep_crawling.filters import SEOFilter

print(to_serializable_dict(SEOFilter(threshold=0.5, keywords=["python"], weights={"title_kw": 1.0})))
# {'type': 'SEOFilter', 'params': {'threshold': 0.5}}
OS

Windows 11 (platform-independent)

Python version

3.13

Browser

Not involved

Error logs & Screenshots (if applicable)

None; no error is raised.

Found by @SohamKukreti in the review of #2425. Unlike the classes fixed there, the raw keyword list has to be stored, not only exposed, because only the compiled pattern was kept. I'll open a PR.

Ngôn ngữ chính
Python
Star
87.2k
Fork
9.1k
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
25

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

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 unclecode/crawl4ai

Tất cả issue của unclecode/crawl4ai

Issue tương tự

Thêm issue về Python

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.