Skip to content

fix: escape spaces in company name search query for Solr - #1130

Merged
ale23yfm merged 1 commit into
masterfrom
fix-1126-company-name-search
Aug 7, 2026
Merged

fix: escape spaces in company name search query for Solr#1130
ale23yfm merged 1 commit into
masterfrom
fix-1126-company-name-search

Conversation

@sebiboga

@sebiboga sebiboga commented Aug 7, 2026

Copy link
Copy Markdown
Member

Fixes #1126

Problem

GET /v1/company/?name=EVOLUTION%20PRO returned nothing, even though EVOLUTION PRODUCTS RO S.R.L. exists in the company core.

The old code built the query with rawurlencode($name), turning the space into %20, which http_build_query then encoded again (%2520). Solr received a literal %20 and matched no documents.

Fix

  • Escape spaces with a backslash (\\ ) for Solr syntax instead of rawurlencode, so spaces in company names are searched correctly.
  • Use SOLR_SERVER and PROTOCOL env vars instead of hardcoded http:// + PROD_SERVER.

Verified locally

  • ?name=EVOLUTION%20PRO -> returns EVOLUTION PRODUCTS RO S.R.L.
  • ?name=EVOLUTION -> 18 companies
  • ?cif=36034853 -> correct company; unknown CIF -> 404

Use SOLR_SERVER/PROTOCOL env vars and escape spaces with backslash
instead of rawurlencode, which double-encoded the query via
http_build_query and caused company name searches with spaces to
return nothing. Fixes #1126.
@sebiboga
sebiboga requested a review from ale23yfm August 7, 2026 18:23
@ale23yfm
ale23yfm merged commit 68bd6e4 into master Aug 7, 2026
1 check passed
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.

v1/company/?name=EVOLUTION%20PRO should return EVOLUTION PRODUCTS RO S.R.L.

2 participants