Search field autocomplete / predictive

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

Search field autocomplete / predictive

Post by urheat »

How could I make search field work like Google Search (autocomplete, predictive search)?
faglork

Re: Search field autocomplete / predictive

Post by faglork »

urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

Re: Search field autocomplete / predictive

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Search field autocomplete / predictive

Post 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
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

Re: Search field autocomplete / predictive

Post 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?
Last edited by urheat on Tue May 26, 2015 5:48 am, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Search field autocomplete / predictive

Post 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.
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

Re: Search field autocomplete / predictive

Post 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!
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Search field autocomplete / predictive

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Locked

Return to “The Lounge”