Skip to content

Add modality field for efficient content filtering #13967

@rtibbles

Description

@rtibbles

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Currently, the modality value is stored in the ContentNode options JSONField, which makes filtering operations very inefficient. This tracking issue covers the work to add a dedicated modality field for efficient querying and to resolve related filtering issues.

Implementation approach

Add a modality CharField to the ContentNode model (in models.py as a locally-calculated cached field) with a database index. This field will be populated during content import by extracting the value from options['modality'].

Technical details

  • Field type: CharField(max_length=50, blank=True, null=True, db_index=True, choices=modalities.choices)
  • Location: kolibri/core/content/models.py (local field, not exported by Studio)
  • Annotation: Extract from options['modality'] during channel import (similar to bitmask fields)
  • Upgrade task: Backfill existing channels
  • Expected values: QUIZ, SURVEY, CUSTOM_NAVIGATION, and future additions (5-15 total values anticipated)

🤖 This issue was written by Claude Code, under supervision, review and final edits by @rtibbles 🤖

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    DEV: backendPython, databases, networking, filesystem...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions