Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Django Cast 0.2.58 documentation
Django Cast 0.2.58 documentation

Getting Started

  • Installation
  • Tutorial

Core Concepts

  • Architecture Overview
  • Blogs and Posts
  • Podcasts and Episodes
  • StreamField Blocks
  • Content Organization
  • Categories / Tags

Media & Assets

  • Media Handling
  • Images and Galleries
  • Audio and Transcripts
  • Video

Features

  • Comments
  • Templates / Themes
  • Social Media
  • Frontend
  • Feeds
  • Search
  • Performance

Reference

  • API Documentation
  • Models
  • Settings
  • Context Processors
  • Django-Admin
  • Management Commands

Operations

  • Backup
  • Database Migrations
  • Deployment
  • Troubleshooting

Developer Guide

  • Development
  • Contributing
  • Release Process

About

  • Glossary
  • Credits
  • Releases
    • 0.2.58 (2026-06-02)
    • 0.2.57 (2026-05-22)
    • 0.2.56 (2026-05-12)
    • 0.2.55 (2026-04-26)
    • 0.2.54 (2026-03-09)
    • 0.2.53 (2026-02-26)
    • 0.2.52 (2026-01-17)
    • 0.2.51 (2025-12-21)
    • 0.2.50 (2025-12-14)
    • 0.2.49 (2025-10-12)
    • 0.2.48 (2025-08-11)
    • 0.2.47 (2025-07-12)
    • 0.2.46 (2025-07-08)
    • 0.2.45 (2025-05-12)
    • 0.2.44 (2025-03-09)
    • 0.2.43 (2025-02-23)
    • 0.2.42 (2025-02-15)
    • 0.2.41 (2025-01-05)
    • 0.2.40 (2024-11-03)
    • 0.2.39 (2024-10-13)
    • 0.2.38 (2024-08-04)
    • 0.2.37 (2024-07-20)
    • 0.2.36 (2024-07-07)
    • 0.2.35 (2024-06-30)
    • 0.2.34 (2024-06-16)
    • 0.2.33 (2024-05-26)
    • 0.2.32 (2024-05-12)
    • 0.2.31 (2024-05-05)
    • 0.2.30 (2024-04-26)
    • 0.2.29 (2024-03-23)
    • 0.2.28 (2024-03-17)
    • 0.2.27 (2024-01-02)
    • 0.2.26 (2023-12-31)
    • 0.2.25 (2023-12-10)
    • 0.2.24 (2023-11-25)
    • 0.2.23 (2023-10-21)
    • 0.2.22 (2023-09-18)
    • 0.2.21 (2023-09-04)
    • 0.2.20 (2023-08-28)
    • 0.2.19 (2023-08-21)
    • 0.2.18 (2023-08-14)
    • 0.2.17 (2023-08-07)
    • 0.2.16 (2023-06-04)
    • 0.2.15 (2023-05-22)
    • 0.2.14 (2023-05-01)
    • 0.2.13 (2023-04-17)
    • 0.2.12 (2023-04-10)
    • 0.2.11 (2023-04-03)
    • 0.2.10 (2023-03-26)
    • 0.2.9 (2023-03-20)
    • 0.2.8 (2023-03-13)
    • 0.2.7 (2023-03-05)
    • 0.2.6 (2023-02-20)
    • 0.2.5 (2023-02-13)
    • 0.2.4 (2023-02-06)
    • 0.2.3 (2023-01-30)
    • 0.2.2 (2023-01-15)
    • 0.2.1 (2023-01-06)
    • 0.2.0 (2022-12-18)
    • 0.1.35 (2020-10-25)
    • 0.1.34 (never released)
    • 0.1.33 (never released)
    • 0.1.32 (never released)
    • 0.1.31 (never released)
    • 0.1.30 (2020-10-25)
    • 0.1.29 (2020-01-03)
    • 0.1.28 (2019-06-03)
    • 0.1.27 (2019-05-27)
    • 0.1.26 (2019-05-23)
    • 0.1.25 (2019-05-23)
    • 0.1.24 (2019-05-22)
    • 0.1.23 (2019-05-16)
    • 0.1.22 (2019-04-28)
    • 0.1.21 (2019-04-24)
    • 0.1.20 (2019-04-24)
    • 0.1.19 (2019-04-24)
    • 0.1.18 (2019-04-18)
    • 0.1.17 (2019-04-15)
    • 0.1.16 (2019-03-23)
    • 0.1.15 (2019-03-23)
    • 0.1.14 (2019-03-23)
    • 0.1.13 (2019-03-22)
    • 0.1.12 (2019-03-22)
    • 0.1.11 (2019-03-21)
    • 0.1.10 (2019-03-21)
    • 0.1.9 (2019-03-12)
    • 0.1.8 (2019-02-28)
    • 0.1.7 (2019-02-28)
    • 0.1.6 (2019-02-28)
    • 0.1.5 (2018-11-21)
    • 0.1.4 (2018-11-18)
    • 0.1.3 (2018-11-17)
    • 0.1.2 (2018-11-08)
    • 0.1.1 (2018-11-07)
    • 0.1.0 (2018-11-05)
Back to top
View this page

Search¶

Django Cast supports full-text search and faceted filtering on blog and podcast list pages. Filtering is handled by PostFilterset (in cast.filters) and is available in two contexts:

  • Blog/podcast list pages (Wagtail page views)

  • Wagtail API pages listing when use_post_filter=true

Filter Parameters¶

The filter parameter names are shared between UI routes and API routes.

  • search: full-text search via Django Cast’s modelsearch wrapper

  • date_after and date_before: date range filter for visible_date (from the date filter)

  • date_facets: single month facet, format YYYY-MM

  • category_facets: category slug

  • tag_facets: tag slug

  • o: ordering for visible_date (visible_date or -visible_date)

Default configuration:

CAST_FILTERSET_FACETS = [
    "search",
    "date",
    "date_facets",
    "category_facets",
    "tag_facets",
    "o",
]

Search and Filter Examples¶

Blog list routes (example slug styleguide-blog):

/styleguide-blog/?search=python
/styleguide-blog/?date_after=2026-01-01&date_before=2026-12-31
/styleguide-blog/?date_facets=2026-02&tag_facets=django
/styleguide-blog/?category_facets=til&o=-visible_date

Wagtail API pages endpoint (if cast is mounted at /cast/):

/cast/api/wagtail/pages/?type=cast.Post&child_of=4&use_post_filter=true&search=python
/cast/api/wagtail/pages/?type=cast.Post&child_of=4&use_post_filter=true&date_facets=2026-02

Facet Behavior¶

  • Search input is normalized before it reaches modelsearch. Null bytes are stripped, repeated whitespace/hyphen runs are collapsed, leading/trailing whitespace is removed, and very long values are capped. Malformed or punctuation-only public searches return no results instead of raising a server error.

  • In the default (legacy) mode, facet counts reflect the currently filtered queryset. The ?mode=modal API uses a different counting strategy; see Conjunctive vs Disjunctive Faceting for details.

  • Tag/category facet options with count 0 are omitted from the standard filterset choices.

  • Date facets are month buckets generated from visible_date.

  • Invalid facet values are ignored: - date_facets must parse as YYYY-MM. - tag_facets and category_facets must pass Django slug validation.

  • Generated facet links intentionally drop page from the query string to avoid broken pagination URLs.

Conjunctive vs Disjunctive Faceting¶

django-cast provides two facet API modes. The default (legacy) mode returns counts matching all currently active filters. The modal mode (?mode=modal) adjusts counts per facet group so a UI can show “what happens if I switch this facet value next?”.

Both modes are documented in Modal Facet API.

These correspond to two counting strategies common in faceted navigation.

Conjunctive faceting¶

Counts are computed from the fully filtered result set (all active filters applied).

This is the strategy used by the default (legacy) facet API.

Disjunctive faceting¶

For a given facet group, counts are computed with that group temporarily excluded, while keeping the other active filters.

This is the strategy used by the modal facet API (?mode=modal).

Practical example¶

Assume posts:

  • Post A: category=til, tag=python

  • Post B: category=til, tag=django

  • Post C: category=weeknotes, tag=python

Active URL state:

/styleguide-blog/?category_facets=til&tag_facets=python

Conjunctive tag counts (legacy):

  • Current result set is only Post A.

  • Tag options from that set are effectively python (1).

  • django is not available until you first clear the tag filter.

Disjunctive tag counts (modal):

  • Keep category_facets=til but exclude the current tag filter while counting tag options.

  • Eligible posts are Post A and Post B.

  • Tag options become python (1) and django (1).

  • Clicking django switches directly to:

/styleguide-blog/?category_facets=til&tag_facets=django

Why django-cast has both¶

  • Legacy mode keeps backward-compatible behavior for existing clients.

  • mode=modal supports one-click switching inside a facet group (without a clear-first step).

  • The total result count still reflects all active filters combined.

  • Each facet group’s option counts answer: “if I change only this group, how many results would I get?”.

  • See API Documentation for exact response fields (result_count, all_count, options).

Modal Facet API¶

For modal UIs, use /cast/api/facet_counts/<blog_id>/?mode=modal (path prefix depends on how you include cast.urls).

Modal payloads are calculated by cast.modal_facet_counts.get_modal_facet_counts and return:

  • result_count for the fully selected state

  • Per-group all_count with that group temporarily excluded

  • options including zero-count values so the modal can keep the full facet universe visible

See API Documentation for exact response shapes.

Architecture Notes¶

For the end-to-end request/data flow (blog queryset, PostFilterset, legacy serializer path, and modal API path), see Search and Facet Flow.

Next
Performance
Previous
Feeds
Copyright © 2025, Jochen Wersdörfer
Made with Sphinx and @pradyunsg's Furo
On this page
  • Search
    • Filter Parameters
    • Search and Filter Examples
    • Facet Behavior
    • Conjunctive vs Disjunctive Faceting
      • Conjunctive faceting
      • Disjunctive faceting
      • Practical example
      • Why django-cast has both
    • Modal Facet API
    • Architecture Notes