November Happy Hour will be moved to Thursday December 5th.

Autocomplete endpoint

ZZ
ZZ
Vote:
 

Hi,

We are trying to implement auto complete in our new Optimizely website (CMS 12). 

We are using Optimizely Find and we are unsure as of what the endpoint for getting autocompletion results is.
So far, using the info from https://docs.developers.optimizely.com/digital-experience-platform/v1.1.0-search-and-navigation/docs/search-statistics#autocomplete

we have tried both localhost:<port>/_autocmomplete?prefix=<search_query>, which turned out it did not make a lot of sense and the second option was using the developer index followed by the endpoint. This one gives the following CORS error when called within the code:

 

When going to that URL we get an authorization error as follows:

Search statistics

This topic describes the autocomplete, spelling suggestion, and related queries functionality provided by the search statistics component of the Optimizely Search & Navigation API.

We are using axios and tried to solve the CORS error by setting headers in the request, but it had no success.Our question is what is the correct endpoint we need to access in order to see autocomplete results, and if it is indeed the index how do we bypass the said errors?

Any help would be appreaciated 

#293491
Dec 21, 2022 15:18
Vote:
 

Hi ZZ

Please try using the Find proxy endpoint and not the service URL. 

Model.PublicProxyPath" + "/_autocomplete?prefix= 

Which should translate into

/find_v2/_autocomplete?prefix=

Also if you want to test directly against the service url you need the index name as well. 
This is the reason for the HTTP 403 response.

https://service_url/key/index_name/_autocomplete?prefix=test
#293494
Dec 21, 2022 16:16
ZZ
Vote:
 

Hi Dada,

Thanks a lot for your input.

Have a great evening 

#293495
Dec 21, 2022 16:20
Vote:
 

Hello,

How can the PublicProxyPath be found? We used to get it from IFindUiConfiguration.AbsolutePublicProxyPath() in CMS 11 but that interface doesn't seem to exist in CMS 12.

#294760
Jan 16, 2023 9:02
Vote:
 

In EPiServer.Find.UI you should have

FindUIOptions.PublicProxyPath()
FindUIOptions.AbsolutePublicProxyPath()
#294763
Jan 16, 2023 10:58
Vote:
 

Thanks @dada!

#294765
Jan 16, 2023 11:31
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.