Hello,
I am using Episerver Find 11 and implementing the autocomplete functuionality using Jquery as mention on episerver document http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/11/search-statistics/search-statistics/
This is my search button
<input id="search" oninput="myFunction()" type="search" tabindex="1" name="q" value="@Model.SearchQuery" />
This is my script code.
<script type="text/javascript"> function myFunction() { $.get('/find_v2/_autocomplete?prefix=q&size=4', function (data) { alert(JSON.stringify(data)); $.each(data.Hits, function (index, value) { $('#search').append(value.Query); } ) }, "jsonp"); }</script>
When I check data using url http://localhost:55363/find_v2/_autocomplete?prefix=ho&size=5 on my localhost it gives me following results.
{"status":"ok","hits":[{"query":"homeclass","type":"editorial"},{"query":"homemade","type":"editorial"},{"query":"homemaid","type":"editorial"},{"query":"homework","type":"editorial"},{"query":"homeland","type":"editorial"}]}
but when I run the code on UI and search, in alert I am geeting 0 hits and alert is showing
{"status":"ok","hits":[]}
Also In my controller for tracking I am using .track() method.
var unifiedSearch = SearchClient.Instance.UnifiedSearchFor(q).UsingSynonyms().ApplyBestBets().Track().Skip(skipNumber).Take(pageSize);
Thanks in advance,