Gravatar for vinayak.chauhan@digitaslbi.com

Question by vinayak.chauhan, May 2, 2017 1:48 PM

about creating new searchbox to hit coveo api

Hello,

1. Want to implement new textbox through which i will click on my input button to hit coveo api to redirect to search result page and show the result.

How can i do that? any example will be good.

Also i need to do it with MVC and on cloud. I want to add my own textbox and button to which i will bind properties required by Coveo.

2. Do we have any list of APIs provided by Coveo which i can hit directly to return JSON may be?

Thanks,

Gravatar for flguillemette@coveo.com

Comment by François Lachance-Guillemette, May 2, 2017 2:06 PM

Which product are you using? Coveo for Sitecore? Coveo for Salesforce? Coveo Cloud?

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, May 2, 2017 2:13 PM

Coveo for Sitecore provides the Searchbox Component that fills exactly that use case: Redirect to the search page with the entered query.

The recommended procedure is to Duplicate the Component and then add customizations to the duplicate to have your required styling and behavior.

Coveo for Sitecore offers a wide range of components that you can use to create your search page, so most likely you won't even need to poke directly the API.

Gravatar for vinayak.chauhan@digitaslbi.com

Comment by vinayak.chauhan, May 2, 2017 2:25 PM

But i dont want to use given <div>. like below

<div class="CoveoSearchbox"
             data-enable-omnibox="true"
             data-omnibox-timeout="@Model.OmniboxTimeout"
             data-enable-field-addon="@Model.OmniboxEnableFieldAddon"
             data-enable-simple-field-addon="@Model.OmniboxEnableSimpleFieldAddon"
             data-enable-top-query-addon="@Model.OmniboxEnableTopQueryAddon"
             data-enable-reveal-query-suggest-addon="@Model.OmniboxEnableRevealQuerySuggestAddon"
             data-enable-query-extension-addon="@Model.OmniboxEnableQueryExtensionAddon"></div>

I want to add my controls (textbox, button etc) like below:

<form class="" action="">
                    <div class="container">
                        <input class="input" id="q" name="q" type="text" placeholder="Search" value="about"/>
                        <button class="button" type="submit"><i class="search-icon"></i></button>
                    </div>
                </form><br>

And on clicking button, it should redirect to searchpage with passed query.

Ask a question