Try our conversational search powered by Generative AI!

Find and autocomplete using JavaScript

Vote:
 

Hello all,

After migrating to CMS-12, our search textbox that featured autocomplete was no longer functional.  The service call we were making from JavaScript was:

fetch('/find/rest/autocomplete/get/' + this.query)

This now returns a 404.  Perhaps I am missing some configuration, I'm not sure.

I've searched for solutions specific to CMS-12, but there seems to be nothing specific.  In older posts, I have found some references to:

fetch('/find_v2/_autocomplete/?prefix=' + this.query)

This returns a 500 with no details.

Does anyone have an example of how to query for autocomplete for CMS-12?  Or perhaps a suggestion on what is incorrect with my service requests?

Thanks, Kevin

#314459
Dec 20, 2023 16:15
Vote:
 

For your second example, what happens if you remove the slash before the question mark?

fetch('/find_v2/_autocomplete?prefix=' + this.query)
#314463
Dec 20, 2023 20:04
Vote:
 

Thank you Daniel for your response.  I am now on holiday break until Jan 2, so I'll try your suggestion then.  Cheers!

#314464
Dec 20, 2023 20:15
Vote:
 

Daniel, I tried your suggestion and suprise to me, removing the slash no longer throws an error.  Thanks!  

It does appear as though the resulting json has slightly different casing from the prior version which caused a few minor issues.  Hopefully I'm good to go now.

#314984
Jan 02, 2024 20:23
* 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.