Page 1 of 1

Search field autocomplete / predictive

Posted: Fri May 22, 2015 7:21 am
by urheat
How could I make search field work like Google Search (autocomplete, predictive search)?

Re: Search field autocomplete / predictive

Posted: Fri May 22, 2015 7:29 am
by faglork

Re: Search field autocomplete / predictive

Posted: Fri May 22, 2015 7:33 am
by urheat
faglork wrote:https://jqueryui.com/autocomplete/

Cheers,
Alex
Thanks Alex!

I think we need some AJAX also, but I don't know how this is done with CMSMS in a right way.

Re: Search field autocomplete / predictive

Posted: Fri May 22, 2015 8:21 am
by velden
I think you should make a page template only containing {content}
Create a hidden page using that template
Receive parameters sent by your ajax call
Create a UDT and call that on the page using the received parameters

The UDT should then:

- sanitize input
- query for words based on input (LIKE?) in search module tables in database (you might consider checking for extra used options like 'modules')
- build and return the output expected by the auto complete tool you use

Re: Search field autocomplete / predictive

Posted: Fri May 22, 2015 11:15 am
by urheat
Thanks Velden!

This was what I was a bit afraid of. Not so simple.

If I understood correctly, the search is predictive in CMSMS 2.0 or is it just the back end search?

Re: Search field autocomplete / predictive

Posted: Mon May 25, 2015 10:44 am
by velden
I'm thinking to create such a UDT for demo puposes.
Promise to buy Rolf a large cup of coffee and I'll prepare a blog post together with him.

If you need it fast consider sending me a PM (but it would cost you a restaurant meal for two :))

BTW: talking about the core Search module.

Re: Search field autocomplete / predictive

Posted: Tue May 26, 2015 5:48 am
by urheat
velden wrote:I'm thinking to create such a UDT for demo puposes.
Promise to buy Rolf a large cup of coffee and I'll prepare a blog post together with him.

If you need it fast consider sending me a PM (but it would cost you a restaurant meal for two :))

BTW: talking about the core Search module.
Haha! I definitely owe you both meals. Hopefully we meet someday and I can pay my debts ;) Great news!

Re: Search field autocomplete / predictive

Posted: Thu Jun 21, 2018 6:12 pm
by Rolf