Gravatar for pablourquiza@yahoo.com

Question by pablo urquiza, Jun 10, 2015 3:58 PM

Is there an Omnibox option for using a different search page?

Hi guys. This is my first question here so bear with me.

I have a search box in a page that triggers a query and redirects to a results page. All this is done with the coveoquerybox and the search button, initializing with $('#searchBox').coveo('initSearchBox', srchPage). All works well, but now I have to provide suggestions there.

My approach involves using the OmniBoxResultsList, which of course requires me to change the coveoquerybox to a coveoomnibox. So, I got rid of the initsearchbox call.

This makes the omnibox work and the suggestions are showing ok, but now of course it doesn't redirect to my results page when I press the search button.

Is there an option or parameter, analogous to the "srchPage" i was using for the initsearchbox call, that works with the omnibox?

I apologize if this isn't in the right place, but I'm new here.

Thanks!

Pablo.

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Jun 11, 2015 8:56 AM

"My approach involves using the OmniBoxResultsList, which of course requires me to change the coveoquerybox to a coveoomnibox. So, I got rid of the initsearchbox call."

You don't use the CoveoSearchBox? Try this with the initsearchbox call:

<div id="searchBox">
  <div class="CoveoSearchBox" data-activate-omnibox="true"></div>
  <div class="CoveoOmniBoxResultList"></div>
</div>

Hope this helps.

Gravatar for pablourquiza@yahoo.com

Comment by pablo urquiza, Jun 12, 2015 10:15 AM

Every comment helps!

Unfortunately I have to use the omnibox explicitly within the #searchBox div - there is a need to apply different attributes to the input.coveoQueryBox itself, which cannot be done (as far as i know) if I let coveo create the objects within the #searchBox div.

Thank you very much for your time and comment :)

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Jun 15, 2015 8:36 AM

What other options are you talking about?

  1. Are you talking about the 'initSearchBox' call? Because you can initialize additional options like this:

    Coveo.$('#searchBox').coveo('initSearchBox', 'searchPage', additionalOptions);

  2. You can still apply options directly to the queryBox after the 'initSearchBox' call like this :

    Coveo.$('#searchBox').find("input.CoveoQueryBox").attr("placeholder", 'type here');

Gravatar for pablourquiza@yahoo.com

Comment by pablo urquiza, Jun 17, 2015 2:06 PM

Hi sbelzile;

That doesn't really answer my question, but if I just knew that before I had to deliver, I wouldn't have need to ask it in the first place.

Indeed, your #2 is a solution. I ended up solving the problem a different way, but it's great to have this knowledge. Thank you very much for your help and commitment to answer!

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Jun 22, 2015 3:08 PM

There are no need to get rid of the initSearchBox call. If you want to add additionnal options to your searchBox, you can to it this way:

Coveo.$('#searchBox').coveo('initSearchBox', 'searchBox', additionalOptions);   

<div id="searchBox">
  <div class="CoveoSearchBox" data-activate-omnibox="true"></div>
  <div class="CoveoOmniBoxResultList"></div>
</div>

The initSearchBox call will instanciate the components properly, using your additional options. If there are changes that must be done after components initialization (example: a placeholder), it can be done this way:

Coveo.$('#searchBox').find("input.CoveoQueryBox").attr("placeholder", 'type here');
Ask a question