Skip to content

Conversation

@cncases
Copy link
Owner

@cncases cncases commented Jan 17, 2026

Summary by CodeRabbit

  • New Features

    • Added similar case recommendations that appear in case details view, allowing users to discover related cases. This feature is optional and available for criminal case types.
  • Style

    • Updated print styles to properly hide the similar cases section when printing.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2026

Walkthrough

The changes introduce Qdrant-based similar-case retrieval functionality gated by the vsearch feature. The CasePage struct is extended with case ID and similar cases fields. The case handler gains optional Query parameter support and conditional logic to compute similar cases from Qdrant. A new async similar function queries Qdrant's recommendation API. Template and CSS updated to conditionally display similar cases.

Changes

Cohort / File(s) Summary
Qdrant Integration & Case Handler
src/controller.rs
Adds QueryCase struct and similar async function for Qdrant-backed recommendations. Extends CasePage with id, enable_similar, and similar_cases fields. Enhances case handler to accept optional Query parameter, conditionally fetch similar cases when vsearch enabled and with_similar requested, and populate CasePage with results. New Qdrant imports added.
Template UI
templates/case.html
Introduces conditional section rendering similar cases list when enable_similar is true, displaying case IDs and names after main content.
Print Styles
static/style.css
Hides .similar-cases element in print view alongside existing hidden elements.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Handler as Case Handler
    participant DB as Case DB
    participant QC as Qdrant Client
    participant QD as Qdrant Service
    participant Template

    Client->>Handler: GET /case/{id}?with_similar=true
    Handler->>DB: Fetch case details
    DB-->>Handler: Case data
    
    rect rgba(100, 150, 200, 0.5)
    Note over Handler,QD: Similar Cases Retrieval (vsearch feature)
    Handler->>QC: similar(case_id)
    QC->>QD: RecommendPointsBuilder query
    QD-->>QC: Recommendation results
    QC-->>Handler: Vec<u32> similar IDs
    end
    
    Handler->>Handler: Build CasePage with<br/>id, enable_similar, similar_cases
    Handler->>Template: Render with CasePage
    Template->>Template: If enable_similar,<br/>render similar cases section
    Template-->>Client: HTML response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #82: Modifies case handler and template in coordination with main case deserialization logic; both PRs affect the same templates/case.html and handler flow.
  • PR #174: Establishes the vsearch feature and Qdrant integration foundation; this PR extends it with similar-case retrieval and reuses the same feature flag, client imports, and AppState integration.

Poem

🐰 A flutter of whiskers, a twitch of my nose,
Similar cases now bloom where the query goes!
Qdrant's swift dance, through the feature gate, so bright,
Templates render them prettily—oh, what a sight! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'similar' is extremely vague and lacks specificity about what is being added or changed, providing no meaningful context for reviewers scanning pull request history. Revise title to be more descriptive, such as 'Add Qdrant-based similar case retrieval feature' or 'Implement similar case recommendations in case details page'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch similar

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.

@cncases cncases merged commit c8182fb into main Jan 17, 2026
6 checks passed
@cncases cncases deleted the similar branch January 17, 2026 14:59
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