Skip to content

feat(search): add contentTypes filter - #101

Open
VinciGit00 wants to merge 1 commit into
mainfrom
marcovinciguerra/feat/search-content-types
Open

feat(search): add contentTypes filter#101
VinciGit00 wants to merge 1 commit into
mainfrom
marcovinciguerra/feat/search-content-types

Conversation

@VinciGit00

Copy link
Copy Markdown
Member

Mirrors the API change from sgai-stack#955: /api/search now accepts contentTypes and, when the field is omitted, only fetches text-like results (text/html, application/json, text/markdown, text/plain) — PDFs, office documents and images are skipped.

Changes

  • SearchRequest.content_types (serialized as contentTypes)
  • content_types kwarg on ScrapeGraphAI.search() and AsyncScrapeGraphAI.search()
  • FetchContentType gains application/json and text/markdown, and is reordered to match the API enum (it was missing both, so crawl(content_types=...) could not target JSON or Markdown pages either)
  • README documents the parameter and the new default

Verification

  • uv run pytest -q → 28 passed, 1 skipped
  • Round-trip check: SearchRequest(query="x", content_types=["text/markdown", "application/pdf"]) serializes to {"contentTypes": ["text/markdown", "application/pdf"], ...}
  • Verified against the local v2 API: default (no contentTypes) drops a PDF result (4/5 scraped), adding application/pdf fetches it (5/5)

🤖 Generated with Claude Code

Search now accepts contentTypes so callers can pick which content types get
fetched. Adds application/json and text/markdown to FetchContentType to match
the API enum.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@VinciGit00
VinciGit00 force-pushed the marcovinciguerra/feat/search-content-types branch from fbafa92 to a23f016 Compare July 29, 2026 13:06
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant