How to implement proximity search in app search

How to implement proximity search in app search?

@JasonStoltz, please help

Hi @ranjeet.tiwari,

Sorry for the late reply, I have been out for a few days.

You should be able to filter a query by proximity using a geo filter. The documentation for that is here: https://swiftype.com/documentation/app-search/api/search/filters#geo-filters.

You can also boost the relevance score of document based on a proximity. https://swiftype.com/documentation/app-search/api/search/boosts#proximity-boosts

@JasonStoltz
its only for number and geolocation fields.

We want to apply the proximity search on text field and we want to achieve the proximity search functionality which should very similar to elasticsearch.

Please have look at below reference

@ranjeet.tiwari I'm fairly certain that is not possible with App Search, unfortunately.

Thanks @JasonStoltz.....

One more thing....

Can we change the engine name and refresh the result in search ui….
Actually I have 2 tabs in search page...based on selection of tab, I am trying to refresh the result.
Is this possible?

Yes, that should be possible. Can you elaborate?

Like do you have one search box and you'd like to show results from different engines in two different tabs?

yes.... @JasonStoltz
Please have a look
image

@ranjeet.tiwari It would be neat to have a better way to support this, but I'd recommend trying something like the following. Keep in mind that this is just pseudo-code to illustrate the concept I have in mind:

state = {
  engine: 'engine1'
}

const connector = new AppSearchAPIConnector({
  searchKey: "",
  engineName: this.state.engineName,
  hostIdentifier: ""
});

return  <SearchProvider
  config={{
    apiConnector: connector
  }}
>
  <div>
    <SearchBox />
    <Tab1 id="tab1" onClick={() => setState({ engine: 'engine1' })}/>
    <Tab2 id="tab1" onClick={() => setState({ engine: 'engine2' })}/>
  </div>
</SearchProvider>