Skip to content

Conversation

@gefo10
Copy link

@gefo10 gefo10 commented Nov 17, 2025

Closes #103

Description

This PR introduces two new optional query parameters to the search API endpoint (/api/search). These parameters allow external clients to disable specific formatting rules that are currently optimized for the web UI, enabling them to receive "rawer" data formats.


Proposed Change(s)

The two new options are:

  1. disable_cropping: Prevents the truncation (cropping) of long building names.
  2. disable_parsed_id_prefix: Prevents the addition of human-readable building prefixes (e.g., "MW", "MI") to the parsed_id, returning the raw Roomfinder format (archname@building_id) instead.

Changes

  • routes/search.rs: Added disable_cropping: bool and disable_parsed_id_prefix: bool to SearchQueryArgs as new path params and a new struct FormattingConfig for holding formatting config variables.
  • search_executor/formatter.rs: Updated RoomVisitor to respect the new flags when generating parsed_id and handling building name truncation.
  • search_executor/mod.rs: Added new unit tests to confirm the correct behavior for both flags.
  • external/meilisearch.rs: Integrated to use the new FormattingConfig.

How to Test

Tests should pass (cargo test). You can verify the functionality with a few test queries against a local instance:

Scenario Query Expected Output (parsed_id)
Default (MW prefix, cropped) 1010 MW 1010 [Cropped Building Name…]
Cropping Disabled 1010&disable_cropping=true MW 1010 [Full Building Name] (no ellipsis)
Prefix Disabled 1010&disable_parsed_id_prefix=true 1010@5510 (raw Roomfinder ID)
Both Disabled 1010&disable_cropping=true&disable_parsed_id_prefix=true 1010@5510 (raw Roomfinder ID; cropping is ignored)
  • Documentation
    • I have updated the documentation
    • No need to update the documentation

@gefo10 gefo10 changed the title Feature/103 add configurable search formatting options feat(server): 103 add configurable search formatting options Nov 17, 2025
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.

Make search result formatting more configurable in the API

1 participant