Adding Swiftype search in MadCap Flare output?



Has anybody had success using Swiftype search in their MadCap Flare output?

The script installation code causes a bug with the TopNav output (the hamburger menu navigation sporadically breaks and so does the native search feature.) It seems to be a Chrome-only bug.

We suspect this might have something to do with require.js which is used by Flare’s website framework. Any information would be helpful.


Like Google Analytics, Swiftype uses an anonymous function call to initialize some global objects to store configuration data. The conflict with RequireJS was that the anonymous function also deploys the swiftype library into the page which use defines for other libraries like jQuery (a lib dependency). We changed the anonymous function to only initialize the objects, then we set the config data, finally loading the Swiftype library using RequireJS.

Here’s the original code:


Here’s the modified code that worked with RequireJS:

(function(w, n) {
      w['SwiftypeObject'] = n;
      w[n] = w[n] || function() {
          (w[n].q = w[n].q || []).push(arguments);
})(window,  '_st');
_st('install', 'YOUR_INSTALL_KEY');

Good luck to other Swiftype users. Hope someone else finds this helpful.


Thank you for sharing this! I’m working to implement Swiftype on a Flare site and was getting frustrated when the menus vanished. It wasn’t limited to Chrome in my tests, either.


Many thanks for posting this.
I’m evaluating Swiftype and intend to use it with Flare, and no doubt would’ve fallen at this hurdle!


@cgulliver have you added faceted/filtered results to a Flare site? I’ve been able to get the basic search working on mine, but haven’t been able to set up filters. I don’t know enough JavaScript to know if it’s another Flare incompatibility, or if it’s something else.