algoliasearch-rails icon indicating copy to clipboard operation
algoliasearch-rails copied to clipboard

One-way synonyms?

Open robertjwhitney opened this issue 8 years ago • 3 comments

Do you have an example of how to do one-way synonyms with the DSL?

robertjwhitney avatar Oct 13 '16 21:10 robertjwhitney

Do you have an example of how to do one-way synonyms with the DSL?

One-way synonyms are currently not supported in the current DSL. Still wondering how we can handle it because they're not anymore part of the settings and therefore we'll probably need to go for a rake task to "apply/save" them.

redox avatar Nov 25 '16 17:11 redox

This seems to work:

index.save_synonym('my_object_id', { objectID: 'my_object_id', type: 'oneWaySynonym', input: 'NY', synonyms: ['New York', 'NYC'] }, true)

Same thing for other types of synonyms.

https://www.algolia.com/doc/guides/textual-relevance/synonyms/?language=rails#one-way-synonyms

raphi avatar Oct 03 '17 09:10 raphi

index.save_synonym('my_object_id', { objectID: 'my_object_id', type: 'oneWaySynonym', input: 'NY', synonyms: ['New York', 'NYC'] }, true)

Right, they are just not part of the algoliasearch block options.

redox avatar Oct 03 '17 09:10 redox