Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: PathDepthScorer counts query and fragment slashes as path levels

Chiusa Adatta ai principianti
#2,443 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia con PathDepthScorer in crawl4ai.deep_crawling.scorers e usa la riproduzione nell’issue per confrontare /docs/guide con lo stesso percorso più i suffissi di query e frammento. Verifica che le barre finali nei suffissi non influiscano sulla profondità del percorso e che un URL con solo authority e una URL di query non venga considerato come se avesse un percorso. Esegui i casi di regressione dello scorer descritti nell’issue; il lavoro è completato quando i casi con suffissi passano, mentre i controlli indicati e l’algoritmo di profondità esistente rimangono invariati.

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

Descrizione

crawl4ai version

0.9.5, current develop at 240d9cd050b26607355a3bcf977aa73660069590.

Expected Behavior

PathDepthScorer should measure the URL path. Adding query parameters or a fragment should not change the path-depth score, even when those suffixes contain slashes or another URL.

Current Behavior

The scorer locates the first slash after the scheme and counts the entire remaining string, including query/fragment text. With optimal_depth=2, /docs/guide scores 1.0 but /docs/guide?next=/a/b/c scores 0.25. An authority-only URL whose query contains another URL can also be scored as if it had a path. This changes the priority assigned to links during deep crawling.

Reproduction
from crawl4ai.deep_crawling.scorers import PathDepthScorer

scorer = PathDepthScorer(optimal_depth=2)
print(scorer.score("https://example.com/docs/guide"))
print(scorer.score("https://example.com/docs/guide?next=/a/b/c"))
# Expected: 1.0, 1.0. Actual: 1.0, 0.25.

The real public scorer reproduced seven failing regression cases and five passing controls on unmodified develop. Query-only, fragment-only, combined suffixes, and a query URL without a preceding path are affected. Root/path controls, encoded characters and repeated separators are covered.

Proposed Fix

Discard the literal query and fragment suffixes before the existing path lookup. Keep the current depth algorithm, weighting, statistics and caches. This is separate from #2405 (file-extension scoring) and the old queue-direction problem #1080/#1081.

Environment

Windows / Python 3.12.14. Pure local scorer calls, with the installed dependencies and actual current checkout import. No browser, external website, model or network request is needed for the reproduction.

AI assistance: Codex identified this during a source audit for contribution opportunities, ran the original-code reproduction and prepared the minimal repair. No human review is claimed.

Lingua principale
Python
Stelle
86.4k
Fork
9k
Merge medio
3g 13h
PR unite (30g)
24

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.