Skip to content

traffic search matches inside words #12

Description

@galjos

traffic search is a plain substring match, so a place name matches any word containing it.

$ odh traffic search auer --today --source content
count 5
  Bei Moos im Bereich Stuller Wasserfall (km 5,100 - km 5,300) ...
  Im Bereich der Passhöhe (km 22,000 – km 23,000, ...) ...
  Bei Unsere liebe Frau im Walde (km 4,000 - km 4,200) ...

None is in Auer. They match on Stützmauern (retaining wall), which contains auer. Auer is a real municipality in the Unterland, so this is a query a user will type.

v0.5.1 fixed the related identifier-substring problem (a bare 12 matched any record whose message id contained 12) and made road numbers match either spelling. This is the remaining half: matching inside ordinary words.

Fix

Require a word boundary for alphabetic terms. Road tokens (ss12, sp13) already have their own path added in v0.5.1 and should keep matching across the space, so the boundary rule needs to apply to the plain-word case only.

Worth checking against the alias expansion in trafficSearchAlternatives — the cycle aliases added in v0.5.1 (radroute, ciclabil, …) are prefixes by design and must keep matching Radrouten/ciclabile, so this is prefix-vs-infix rather than exact-word.

Done when

  • search auer does not match Stützmauern.
  • search radweg still finds cycle notices, and search ss12 still finds SS 12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions