Skip to content

Add scoring rule evaluation for custom search#499

Open
juandbc wants to merge 1 commit intomaxdorninger:masterfrom
juandbc:fix-custom-search-scoring-rule
Open

Add scoring rule evaluation for custom search#499
juandbc wants to merge 1 commit intomaxdorninger:masterfrom
juandbc:fix-custom-search-scoring-rule

Conversation

@juandbc
Copy link
Contributor

@juandbc juandbc commented Mar 16, 2026

Fixes #498

Summary by CodeRabbit

  • Chores

    • Updated database connection configuration to use the correct host target.
  • Refactor

    • Improved search query handling for movie and television content to use a unified search approach when custom search queries are provided.

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

These changes modify the database configuration and update search query handling in the movie and TV service modules. When search overrides are provided, the services now use a generalized search function instead of specific indexer methods, preserving fallback behaviour for standard queries.

Changes

Cohort / File(s) Summary
Configuration Update
config.dev.toml
Updated database host from "db" to "postgres" and ensured trailing newline formatting in metadata.tvdb block.
Search Override Logic
media_manager/movies/service.py, media_manager/tv/service.py
Modified search query handling to use generalized search() function with override queries (passing is_tv=False for movies, is_tv=True for TV) instead of indexer-specific methods, with fallback to original indexer service calls when no override is supplied.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A rabbit hops through search queries with glee,
Overrides now handled consistently!
From "db" to "postgres" the connection does leap,
While scoring rules apply—no stone left to reap.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The config.dev.toml database host change is unrelated to the scoring rule evaluation feature and appears to be an out-of-scope modification. Remove or isolate the config.dev.toml database host change to a separate PR, as it is not related to the scoring rules feature addressed in issue #498.
Linked Issues check ❓ Inconclusive The PR changes directly address issue #498 by implementing scoring rule evaluation in the custom search override path, though the changes appear incomplete. Verify that all code paths calling the modified search methods properly invoke evaluate_indexer_query_results to complete the scoring pipeline as required by issue #498.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: adding scoring rule evaluation for custom search operations, which matches the primary change across both service files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use your project's `ruff` configuration to improve the quality of Python code reviews.

Add a Ruff configuration file to your project to customize how CodeRabbit runs ruff.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@config.dev.toml`:
- Line 33: The database host in config.dev.toml is set to "postgres" but the dev
docker-compose service is named "db", causing a mismatch; update the host value
for the DB connection (the host key in config.dev.toml) from "postgres" to "db"
so it matches the docker-compose.dev.yaml service name and restores
connectivity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 11f51d91-1a94-4d03-83a9-7f6c85bd4217

📥 Commits

Reviewing files that changed from the base of the PR and between f525399 and 1ab337d.

📒 Files selected for processing (3)
  • config.dev.toml
  • media_manager/movies/service.py
  • media_manager/tv/service.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-and-push (arm64, ubuntu-24.04-arm)
  • GitHub Check: build-and-push (amd64, ubuntu-24.04)
🔇 Additional comments (3)
config.dev.toml (1)

175-175: No functional concern here.

This URL line appears semantically unchanged; this looks like a formatting-only edit.

media_manager/movies/service.py (1)

214-220: Good change: override and default movie searches now converge before scoring.

Both paths now return results that are passed through evaluate_indexer_query_results (Lines 221-223), so custom search overrides receive the same scoring treatment as standard searches.

media_manager/tv/service.py (1)

215-222: Nice fix: season override flow now mirrors normal flow semantics.

The override branch uses generic search, while the default path keeps season-specific search; both continue through season filtering and scoring evaluation, which addresses the reported custom-search scoring gap.


[database]
host = "db"
host = "postgres"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Database host no longer matches the default dev Compose service key.

docker-compose.dev.yaml defines the PostgreSQL service as db, but this config now points to postgres. That mismatch can break DB connectivity in the default dev stack.

Suggested fix
 [database]
-host = "postgres"
+host = "db"
 port = 5432
 user = "MediaManager"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
host = "postgres"
[database]
host = "db"
port = 5432
user = "MediaManager"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config.dev.toml` at line 33, The database host in config.dev.toml is set to
"postgres" but the dev docker-compose service is named "db", causing a mismatch;
update the host value for the DB connection (the host key in config.dev.toml)
from "postgres" to "db" so it matches the docker-compose.dev.yaml service name
and restores connectivity.

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.

[BUG] Scoring rules not applied to custom search

1 participant