Highlighted
mukerrem
New Creator

Is there any way to filter the CrownPeak Autocomplete results ?

I want to change the source of the autocomplete words. It is searching and autocomplete from all content. But I want to get from a specific input field.

0 Kudos
4 Replies
Crownpeak Employee FerdinandLugo
Crownpeak Employee

Re: Is there any way to filter the CrownPeak Autocomplete results ?

Are you able to be a little more specific? Please provide a little more context/information and screenshot if possible.
0 Kudos
mukerrem
New Creator

Re: Is there any way to filter the CrownPeak Autocomplete results ?

Thank you, ferdinandLugo. I'm using "crownpeak.searchg2.autocomplete-1.0.2.js" this library to autocomplete the keyword field results. It is parsing all value in the SearchG2 Json file. But I just want to parse only in a field like "custom_s_tag_name". Screenshot; https://pasteboard.co/IhFlP95.png

 

0 Kudos
Moderator
Moderator

Re: Is there any way to filter the CrownPeak Autocomplete results ?

There isn't a way to so this with the supplied Search G2 Autocomplete SDK because the underlying implementation is just using a straight forward query search (q=...) against the collection. These searches will only search the default 'title' and 'content' fields as there isn't any field specifier.

You have a couple of options:

  1. The source code for the Search G2 Autocomplete SDK is browseable  so you could look at taking a copy and customise that to pass the parameters you need; or
  2. Don't use the autocomplete library for this at all. If you are looking to provide autocomplete against a limited set of values (tags in your case), it would be more efficient to do a SINGLE query for all the tags using the regular search SDK and then implement an autocomplete field on the client side (or use a pre-built autocomplete library) without going back and forth to Search G2.
0 Kudos
MarinK
Crownpeak (Retired)

Re: Is there any way to filter the CrownPeak Autocomplete results ?

Hi  @mukerrem  ,

Does this answer your question?  Or, do you need more information?

All the best,

Marin Klostermeier - @MarinK 

 

0 Kudos