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

content-type-field

views-filters-proximity

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

drupix created an issue. See original summary.

socialnicheguru’s picture

Status: Active » Needs review
christianadamski’s picture

Status: Needs review » Postponed (maintainer needs more info)

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

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

drupix’s picture

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...

christianadamski’s picture

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?

drupix’s picture

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...

christianadamski’s picture

Version: 8.x-3.12 » 4.x-dev
Status: Postponed (maintainer needs more info) » Needs work

christianadamski’s picture

Status: Needs work » Fixed

Added the bounding box parameter for photon in 4.x. Version 3 is slowly winding down and will not be handled anymore for this.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • f5d28363 committed on 4.x
    feat: #3347056 Support for extra search value in Photon
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.