Skip to content

fix(search-service): fix global search issue#2561

Merged
yeshamavani merged 2 commits into
masterfrom
GH-2553
Jun 19, 2026
Merged

fix(search-service): fix global search issue#2561
yeshamavani merged 2 commits into
masterfrom
GH-2553

Conversation

@Sourav-kashyap

Copy link
Copy Markdown
Contributor

fix global search issue
GH-2553

Description

In Global Search, users are unable to see search results when searching for names containing . (dot), for example: Deal 10.1.
The issue originates from the _formatAndSanitize method in query.builder.ts, which is used by search.provider.ts.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • Performed a self-review of my own code
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes

@Sourav-kashyap Sourav-kashyap self-assigned this Jun 10, 2026
@Sourav-kashyap Sourav-kashyap requested review from a team and akshatdubeysf as code owners June 10, 2026 11:11
@Sourav-kashyap Sourav-kashyap added the bug Something isn't working label Jun 10, 2026
@Sourav-kashyap Sourav-kashyap force-pushed the GH-2553 branch 2 times, most recently from e242a42 to 8e3d9eb Compare June 10, 2026 11:34
@a-ganguly a-ganguly requested a review from Copilot June 10, 2026 11:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes PostgreSQL global-search token sanitization so search terms containing dots (e.g., Deal 10.1) are preserved instead of being split/removed, and adds unit coverage for the updated sanitization behavior.

Changes:

  • Update PsqlQueryBuilder._formatAndSanitize to allow . in tokens and strip unsafe to_tsquery operators.
  • Add unit tests covering dotted terms (decimals, project names, IPs) and mixed punctuation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
services/search-service/src/classes/psql/query.builder.ts Adjusts match sanitization/tokenization to preserve dots for PostgreSQL full-text search queries.
services/search-service/src/tests/unit/psql/query.builder.unit.ts Adds targeted unit tests for _formatAndSanitize with dotted search terms and mixed characters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/search-service/src/classes/psql/query.builder.ts Outdated
@vaibhavbhalla2505

Copy link
Copy Markdown
Contributor

I have checked it, and it's working fine now.

before:
Screenshot 2026-06-10 at 4 30 44 PM

now:
Screenshot 2026-06-10 at 4 31 45 PM

Comment thread services/search-service/src/classes/psql/query.builder.ts
@yeshamavani yeshamavani merged commit 560af9d into master Jun 19, 2026
9 checks passed
@yeshamavani yeshamavani deleted the GH-2553 branch June 19, 2026 06:11
@sonarqubecloud

Copy link
Copy Markdown

SonarQube reviewer guide

Summary: Add comprehensive unit tests and improve the _formatAndSanitize method to preserve dots in search terms while properly handling PostgreSQL full-text search special characters.

Review Focus: The core logic change in _formatAndSanitize modifies character sanitization by preserving dots (essential for version numbers and project names) while explicitly removing PostgreSQL tsquery operators. Verify that the new regex patterns correctly handle edge cases and don't introduce security vulnerabilities or unexpected query behavior. Pay special attention to the trailing dot removal logic and the two-stage filtering approach.

Start review at: services/search-service/src/classes/psql/query.builder.ts. This file contains the functional change that alters search query behavior; the unit tests should be reviewed after confirming the implementation is correct.

💬 Please send your feedback

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
51.0% Duplication on New Code

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In Global Search, users are unable to see search results when searching for names containing . (dot).

5 participants