Autocomplete in opensearch

1k views Asked by At

I have done autocomplete functionality for opensearch using WCF. But we are using 3.5, so I now need to achieve the same without using WCF.

Any idea or please send me any useful link.

My scenario is when I type name, it should fetch related name from db and display. I have a webmethod to fetch data from db. All I need is how to mention the template in opensearch.xml. I was mentioning wcfservice.

please help me

1

There are 1 answers

0
Jannie Theunissen On

You need the following syntax in your search.xml file:

<Url type="application/x-suggestions+json" template="http://www.example.com/searchcontroller/{searchTerms}"/>

If someone starts typing in fre the method on the search controller that looks for suggestions should then return a JSON array of suggestions in this format:

["fre", ["frequent", "freeze", "freak"]]

Have a look at Mozilla's documentation