Steps for Sphinx Documentation Search by Expertrec
- Create a Search Engine for your sphinx documentation site from the Expertrec control panel. This is very simple you just need to put your site URL, select your region and that’s it. Expertrec search engine will start indexing web pages from your site.
- Take site id from Expertrec Control panel. Create _static/expertrec.js and put the following javascript code in it.
(function() { var id = 'site-id'; <!--replace with site-id of your own --> var ci_search = document.createElement('script'); ci_search.type = 'text/javascript'; ci_search.async = true; ci_search.src = 'https://cse.expertrec.com/api/js/ci_common.js?id=' + id; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ci_search, s); })();
- Replace default sphinx search box by creating _templates/searchbox.html and put the following code in it
<ci-search></ci-search>
-
Finally, add a reference to expertrec.js in conf.py and build your site.
html_js_files = [ 'expertrec.js' ]
Expertrec search engine is very cost-effective, fast, and provides highly relevant results. With Expertrec, you will be able to control each and every aspect of your site search engine maybe its filters, scoring, sorting, synonyms. Also, you can fully control the search UI from Expertrec control panel. Know more about the Expertrec search engine and pricing.