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

Ouverte
#2,441 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@Siddharth-DWT y travaille déjà.

Depuis le 24/10/2026.

  • #2442 par @Siddharth-DWT — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
38/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
Python
Étoiles
87.2k
Forks
9.1k
Merge moyen
1 j 6 h
PR mergées (30 j)
25

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de unclecode/crawl4ai

Toutes les issues de unclecode/crawl4ai

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.