Skip to content

[Feature Request] Enhanced Message Search with Advanced Filtering Capabilities #987

@Riya-chandra

Description

@Riya-chandra

Problem Statement
The current search functionality in Rocket.Chat lacks granular filtering options, making it difficult for users to efficiently locate specific messages in high-volume channels. Based on user feedback and community discussions, search results often return irrelevant matches, and there's no way to narrow down results by common criteria such as date ranges, file types, or specific users.
This limitation becomes particularly problematic in:

Enterprise environments with thousands of messages daily
Support channels where historical context is critical
Teams collaborating across multiple time zones

Proposed Solution
Implement an advanced search system with the following capabilities:

  1. Filter Options:

Date range selection (from/to)
Search by specific user/sender
Filter by content type (text, files, links, code snippets)
File type filtering (images, PDFs, documents)
Channel/Room-specific search scope

  1. User Experience Improvements:

Real-time search with optimized debouncing
Syntax highlighting for matched terms in results
Message context preview (surrounding messages)
Search history persistence (last 10 queries)
Keyboard shortcuts for power users

  1. Performance Optimizations:

Backend: Implement efficient MongoDB text indexes
API: Paginated search results with lazy loading
Frontend: Virtual scrolling for large result sets
Caching layer for frequently accessed searches

Technical Approach
Backend Changes:

- Enhance existing `/api/v1/chat.search` endpoint
- Add query parameters for filters (dateFrom, dateTo, userId, fileType, etc.)
- Optimize MongoDB aggregation pipeline
- Implement proper indexing strategy on messages collection

Frontend Changes:

- Create new SearchModal component with filter UI
- Implement debounced search hook (300ms delay)
- Add search result highlighting utility
- LocalStorage for search history management

Database:
- Add compound indexes: { msg: "text", ts: -1, u._id: 1 }

Would like to work on this feature.

Suggested Labels: feature-request, enhancement, gsoc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions