**As a** user **I want to** search for documents **So that** I can quickly find the information I need. **Description** Users need an efficient way to search for documents within the system, enabling them to quickly locate relevant information by file name or document content. The search functionality should be flexible, allowing users to filter results by file type, date range, or author, and should provide a smooth user experience with features like recent searches, search suggestions, highlighting of matched keywords, and error handling. The system should also paginate results to ensure usability when large numbers of documents are returned. **Acceptance Criteria** # 1. Default Search by File Name and Content **Given** the user enters a keyword in the search bar **When** the system performs a search **Then** the system should first search for matching file names and, if none are found, search within document contents, displaying results in descending order of match percentage. # 2. Search by File Name (Using Filter) **Given** the user selects "search by file name" filter and enters a file name keyword **When** the search is performed **Then** the system should display documents ordered by the percentage of match in their file names. # 3. Search by File Content (Using Filter) **Given** the user selects "search by file content" filter and enters a keyword **When** the search is performed **Then** the system should display document snippets or sections with a high matching score to the keyword. # 4. Highlighting Matched Keywords **Given** the search results are displayed **When** the results contain matches in file names or document contents **Then** the system should highlight the matching keywords in the displayed results. # 5. Search Filters **Given** the user applies filters such as file type, date range, or author **When** the search is performed **Then** the system should narrow down the search results according to the applied filters. # 6. Pagination of Results **Given** the search returns more results than the defined threshold **When** the results are displayed **Then** the system should paginate the results for easier browsing. # 7. Recent Searches **Given** the user has performed previous searches **When** the user accesses the search bar **Then** the system should display a list of recent search keywords and allow quick repetition of previous searches. # 8. Search Suggestions **Given** the user begins typing in the search bar **When** the user enters at least one character **Then** the system should suggest possible file names or frequently used keywords. # 9. Error Handling **Given** no matching results are found for the entered keyword **When** the search completes **Then** the system should display a friendly message and suggest alternative keywords.