-
Notifications
You must be signed in to change notification settings - Fork 0
fix: index show metadata fields #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive Qdrant payload indices for show metadata fields to enable efficient filtering of episodes by show title, season number, and episode number during media retrieval.
- Adds new fields (
show_title,season_title,season_number,episode_number,genres,collections) to the PlexItem model - Creates payload indices for show metadata and other fields with proper data types (KEYWORD for titles, INTEGER for numbers)
- Implements a new
query_mediatool with structured filtering capabilities and updates all existing tools to use flattened payload data
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mcp_plex/types.py | Adds show/season/episode fields and genres/collections to PlexItem model |
| mcp_plex/loader.py | Extracts show metadata from Plex items and creates comprehensive payload indices |
| mcp_plex/server.py | Implements new query_media tool and updates all tools to use flattened payload structure |
| tests/test_loader_integration.py | Captures index creation and validates episode metadata extraction |
| tests/test_server.py | Tests episode filtering through query_media and validates metadata fields |
| pyproject.toml | Version bump to 0.26.38 |
| docker/pyproject.deps.toml | Version bump to 0.26.38 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Coverage Report
|
|||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| if created_collection: | ||
| text_index = models.TextIndexParams( | ||
| type=models.PayloadSchemaType.TEXT, | ||
| tokenizer=models.TokenizerType.WORD, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backfill new payload indexes for existing Qdrant collections
The new episode and text filters rely on payload indexes for fields like show_title, season_number, summary, overview, plot, tagline, and reviews, but index creation still occurs only when the collection is first created (if created_collection:). Upgrading an installation that already has a media-items collection will skip this block, leaving those fields unindexed. Text filters then raise InvalidArgument errors in Qdrant because MatchText requires a text index, and keyword filters stay slow. Consider creating the indexes unconditionally and ignoring AlreadyExists errors so the loader can migrate existing collections before query_media is used.
Useful? React with 👍 / 👎.
What
Why
Affects
Testing
uv run ruff check .uv run pytestDocumentation
https://chatgpt.com/codex/tasks/task_e_68e0cc7b6dec8328b789c6df0c622ef7