Support for extra search value in Photon

Created on 9 March 2023, almost 2 years ago
Updated 20 September 2023, over 1 year ago

Problem/Motivation

We are currently working on a site where we need to restrict Photon Autocomplete results to specific region in Switzerland.

Proposed resolution

Accept an extra text to attach to Drupal settings.

User interface changes

An additional field is added to Photon settings (field settings and views proximity filter). If the field is not empty it is then added after the requested term before requesting photon api.

Proposal

✨ Feature request
Status

Postponed: needs info

Version

3.12

Component

Leaflet API

Created by

πŸ‡¨πŸ‡­Switzerland drupix Geneva, πŸ¦ŠπŸ‡¨πŸ‡­

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @drupix
  • Status changed to Needs review over 1 year ago
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡©πŸ‡ͺGermany christianadamski Berlin, Germany

    Not a big fan of this. How about using bias?

    Go to https://github.com/komoot/photon and search for "Bias".

  • πŸ‡¨πŸ‡­Switzerland drupix Geneva, πŸ¦ŠπŸ‡¨πŸ‡­

    Tell me if I'm wrong but there is nothing in code about location_bias_scale...

    For me the "Search extra value" is optional and meant to add limitation in results returned by the autocomplete field.

    For example if I'm typing "vev" in autocomplete, I don't want that appears results from Germany or Czechoslovakia but only from Switzerland or any "Search extra value" set. With this example if I set "Vaud Switzerland" in "Search extra value", while I'm typing "vev" in autocomplete the photon API search for "q=vev Vaud Switzerland" and I'm getting only results in this particular region (Vaud) in Switzerland.

    Just leaving "Search extra value" empty gives the default behavior.

    Maybe I'm missing something...

  • πŸ‡©πŸ‡ͺGermany christianadamski Berlin, Germany

    Bias is not implemented yet. But so far I would prefer it to simply adding words to the query, invisible to the user.

    What's your opinion?

  • πŸ‡¨πŸ‡­Switzerland drupix Geneva, πŸ¦ŠπŸ‡¨πŸ‡­

    This is the case with the patch, the "Search extra value" is not visible by the user.

    If you open the debugger tools of your browser and go under the Network tab you can see the "extra value" added to the query while typing text in the autocomplete field, nothing else...

Production build 0.71.5 2024