Forum

Thread tagged as: Question, Discussion, Runway

Search prediction functionality

Hi

I'm about to start building a 'People Directory' for a client website and I was wondering if it'd be possible to implement a search prediction search box?

Something like how Google Search auto predicts keywords.

The user starts to type and a drop down appears showing suggestions, pulled in from the 'People Directory'

Can anyone point me in the right direction on how I would go about building this into a Perch Runway website?

Stephen Meehan

Stephen Meehan 4 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How is the content stored? Is it in a collection?

Yes, it would be in a collection (I like collections!).

Drew McLellan

Drew McLellan 2638 points
Perch Support

Something like this should work:

/?term=bob
perch_collection('People', [
    'filter' => 'name',
    'match' => 'regexp',
    'value' => '[[:<:]]'.perch_get('term'),
]);