Skip to content

Conversation

coodos
Copy link
Contributor

@coodos coodos commented Aug 27, 2025

Description of change

Makes search case insensitive

Issue Number

closes #340

Type of change

  • Fix (a change which fixes an issue)

How the change has been tested

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • New Features
    • Added public endpoints for user search suggestions and popular searches.
  • Improvements
    • Enhanced user search with pagination, filtering (e.g., verified), and sorting (relevance, name, verified, newest).
    • Responses now include totals, total pages, and next/previous page indicators, plus search info.
    • Faster results through parallel data fetching.
  • API Changes
    • New public routes: /api/users/suggestions and /api/users/popular.
    • Stricter input validation with clear 400 errors for invalid queries; consistent handling of server errors.

Copy link
Contributor

coderabbitai bot commented Aug 27, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds pagination, filtering, and sorting to user search; makes search case-insensitive using ILIKE and fuzzy variants; adds parallel total-count retrieval; introduces public endpoints for search suggestions and popular searches; updates routing to expose these endpoints without auth.

Changes

Cohort / File(s) Summary
User search controller updates
platforms/pictique-api/src/controllers/UserController.ts
Expanded search to accept q, page, limit, verified, sort; input validation; parallel fetch of users and total count; returns pagination metadata and searchInfo. Added endpoints: getSearchSuggestions and getPopularSearches with validation and limits.
Public routes
platforms/pictique-api/src/index.ts
Registered GET routes: /api/users/suggestions and /api/users/popular mapped to controller methods; public access (no authGuard).
User service search + helpers
platforms/pictique-api/src/services/UserService.ts
searchUsers signature expanded (pagination, verified filter, sort). Implemented case-insensitive ILIKE across multiple fields and fuzzy query. Enforced isArchived=false, optional verified filter. Added getSearchUsersCount, getSearchSuggestions, getPopularSearches. Added Raw import and input guards.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant API as Express Router
  participant UC as UserController
  participant US as UserService
  participant DB as DB

  Client->>API: GET /api/users/search?q=&page=&limit=&verified=&sort=
  API->>UC: search(req, res)
  UC->>US: searchUsers(q, page, limit, verifiedOnly, sortBy)
  par Fetch users
    US->>DB: ILIKE/fuzzy query, filters, sort, pagination
    DB-->>US: users[]
  and Count total
    UC->>US: getSearchUsersCount(q, verifiedOnly)
    US->>DB: COUNT with same filters
    DB-->>US: total
  end
  US-->>UC: users[]
  UC-->>Client: { users, total, totalPages, hasNextPage, hasPrevPage, searchInfo }
Loading
sequenceDiagram
  autonumber
  actor Client
  participant API as Express Router
  participant UC as UserController
  participant US as UserService
  participant DB as DB

  Client->>API: GET /api/users/suggestions?q=&limit=
  API->>UC: getSearchSuggestions
  UC->>US: getSearchSuggestions(q, limit)
  US->>DB: ILIKE partial match (lightweight fields)
  DB-->>US: suggestions[]
  US-->>UC: suggestions[]
  UC-->>Client: { suggestions }

  Client->>API: GET /api/users/popular?limit=
  API->>UC: getPopularSearches
  UC->>US: getPopularSearches(limit)
  US->>DB: query verified, non-archived, ordered by popularity
  DB-->>US: popular[]
  US-->>UC: popular[]
  UC-->>Client: { popular }
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
Make search case-insensitive so it works properly ([#340])

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add new public endpoint getSearchSuggestions and route (/platforms/pictique-api/src/controllers/UserController.ts, /platforms/pictique-api/src/index.ts) Not related to making search case-insensitive; introduces a new feature.
Add new public endpoint getPopularSearches and route (/platforms/pictique-api/src/controllers/UserController.ts, /platforms/pictique-api/src/index.ts) Not tied to the bug; adds unrelated discovery feature.
Introduce pagination, verified filter, and sorting in search (/platforms/pictique-api/src/controllers/UserController.ts, /platforms/pictique-api/src/services/UserService.ts) Enhancements beyond the scope of fixing case sensitivity.
Add getSearchUsersCount helper and parallel count retrieval (/platforms/pictique-api/src/services/UserService.ts, /platforms/pictique-api/src/controllers/UserController.ts) Performance/UX improvement, not necessary for the case-insensitive bug fix.

Poem

I burrow through queries, nibbling each byte,
Turned cases to cases that don’t fuss or fight.
With hops through pages and fuzzy delight,
I fetch you suggestions, stars shining bright.
Popular paths? I map them just right—
A pictique of profiles, tasty and light. 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 99bbf5d and acb06a5.

⛔ Files ignored due to path filters (2)
  • infrastructure/eid-wallet/src-tauri/gen/apple/eid-wallet.xcodeproj/project.pbxproj is excluded by !**/gen/**
  • infrastructure/eid-wallet/src-tauri/gen/apple/eid-wallet_iOS/Info.plist is excluded by !**/gen/**
📒 Files selected for processing (3)
  • platforms/pictique-api/src/controllers/UserController.ts (1 hunks)
  • platforms/pictique-api/src/index.ts (1 hunks)
  • platforms/pictique-api/src/services/UserService.ts (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/pictique-search

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coodos coodos merged commit f543b20 into main Aug 27, 2025
0 of 4 checks passed
@coodos coodos deleted the fix/pictique-search branch August 27, 2025 09:13
@coderabbitai coderabbitai bot mentioned this pull request Aug 27, 2025
6 tasks
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] Pictique search doesn't work properly
1 participant