Skip to content

API Search & Filters: 404 Not Found errors on URL-encoded spaces and multiple array parameters #1068

Description

@AndreiBarari

Description:

While integrating and optimizing the frontend search and filtering mechanics with the api.peviitor.ro backend, we encountered two critical routing/processing issues. In both cases, instead of returning a standard JSON response (either the data or an empty [] array), the server throws a 404 Not Found error.


🪲 Issue 1: Spaces in query parameters cause 404 errors

When searching for a company using the /v1/company/ endpoint, if the name parameter contains a space (correctly URL-encoded by the browser as %20), the server fails to process the request.

Steps to reproduce:

  1. Make a GET request using a string with a space:
    https://api.peviitor.ro/v1/company/?name=EPAM%20SYS
  2. Or use the exact, full name of a company from the database:
    https://api.peviitor.ro/v1/company/?name=EPAM%20SYSTEMS%20INTERNATIONAL%20SRL

Expected behavior: The API should decode the %20, perform the search (with partial matching ideally), and return 200 OK with the company data (or an empty array [] if no match is found).
Actual behavior: The server immediately responds with 404 Not Found.


🪲 Issue 2: Multiple values for the same filter cause 404 errors

When a user selects multiple companies in the frontend filter, the frontend constructs the standard HTTP query string for arrays (?key=value1&key=value2). However, the /v1/search/ endpoint fails to process this format and returns a 404 error.

Steps to reproduce:

  1. Make a GET request to the search endpoint repeating the company parameter:
    https://api.peviitor.ro/v1/search/?company=EPAM&company=IBM

Expected behavior: The API should parse the multiple parameters, treat them as an OR condition, and return jobs belonging to either EPAM or IBM.
Actual behavior: The server responds with 404 Not Found.


💥 Impact on Frontend/UX:

  • Users cannot search for companies using multiple words in the filter input.
  • Users cannot filter jobs by more than one company at a time.
  • The frontend has to aggressively catch these unexpected 404 routing errors to prevent the UI from displaying blank data or crashing.

💡 Suggested Fix:

Please check the backend routing and the Solr search engine configuration to ensure:

  1. It properly URL-decodes query string parameters (specifically handling %20 to ).
  2. It correctly parses arrays from query strings when the same key is repeated.
  3. The engine returns 200 OK with {"companies": []} or {"jobs": []} instead of 404 when a query yields zero results.
Image Image Image

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions