Skip to content

Search logic cleanup & error handling #71

Description

@onmax

Scope

This issue captures the remaining search cleanups that are not covered by pagination or shared SQL fragments.

Tasks

  • Create a helper that normalizes search options (page, limit, origin, max distance) and share it across searchLocationsByText, searchLocationsByCategories, and searchLocationsBySimilarCategories. Coordinate with the pagination work in Fix SQL pagination instead of post-fetch slicing #67 and the fragment work in Create shared SQL fragment utilities #70 so the helpers stay aligned.
  • Update both semantic and text search flows to use AND semantics when multiple categories are provided (reuse sqlFragments.categoryFilter once Create shared SQL fragment utilities #70 lands).
  • Improve text search resilience by switching to websearch_to_tsquery or sanitizing tokens before calling to_tsquery.
  • Handle GeoIP zero-coordinate responses without throwing (server/utils/geoip.ts).
  • Reference the OpeningHours error handling added in Fix openNow filtering with real-time data #68 and ensure the shared helper calls it consistently.

Acceptance Criteria

  • Option normalization lives in one place and all search utilities consume it.
  • Category filters produce AND behaviour consistently across all search paths.
  • Text search requests with special characters no longer cause Postgres syntax errors.
  • Requests succeed when GeoIP returns 0 values.

Parent Issue

Part of #66

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendServer-side logic and API endpointsenhancementNew feature or request

    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