How to Install two search engines in one site

Hello Guys,
I have created two search engines on site-search each specific to the corresponding sitemaps according to the language of the search
Engine Search for Spanish looking only at the sitemaps for Spanish
Engine Search for English looking only at the sitemaps for English

This has been done correctly, now the problem resides to install it on my e-commerce
I have tried using both scripts given but I got the error message to install only one

So I did it in this way

<!-- Swiftype -->
<script type="text/javascript">
(function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
(w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
})(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');

if (window.location.href.indexOf('/es') !== -1) {
_st('install', '<CODE-ES>', '2.0.0');
} else if (window.location.href.indexOf('/en-ie') !== -1) {
_st('install','<CODE-EN>', '2.0.0');
}

</script>
<!-- End Swiftype -->

Now I only get the search result in one of the two engines added and according to the Url were I'm at
For example:
If I'm in /es give me results for Spanish (this is Ok as my main language for the store)
if I'm/en-ie give me results for English:

Thanks for your time

Hello,

At a glance, I think this will work. What error message are you getting?

Best,
Quin

Hi,
I was getting an error when adding both scripts in full which was now avoided using it in the way showed above. So, no Errors now and working fine, I decided to share the way, but if there's any other one better than this I'm open for improvements :slight_smile:

Kind regards,
Carlos

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.