What is the best way to implement a typeahead search in Craft. I looked at using ElementAPI to do something similar at this example but it doesn't seem to allow me to wildcard search
https://craftcms.com/docs/templating/search-form
Here's an example of the endpoints I have configured:
I have one entry with a title of "test" when I call the API doing
When I call /entries/te
its returns 0 results. When I call /entries/test
it returns 1 result.
<?php
namespace Craft;
return [
'endpoints' => [
'entries/<search:\w+>' => function($search) {
return [
'elementType' => 'Entry',
'criteria' => ['title' => $search]
];
}
]
];
criteria
block in the ElementAPI configuration?