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

Aperta
#2,441 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Siddharth-DWT ci sta già lavorando.

Dal 24/10/2026.

  • #2442 di @Siddharth-DWT — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

⚙️ 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.

Lingua principale
Python
Stelle
87.2k
Fork
9.1k
Merge medio
1g 6h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di unclecode/crawl4ai

Tutte le issue di unclecode/crawl4ai

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.