Bring back local search

This makes the search.html page that's generated by sphinx function as
the local search, and not the global google based swift_search. The
sphinx integrated search will mean that only documents linked to the
current tree will be returned, which also ensures that searching for
content in stable/pike doesn't jump you to mitaka answers. It also
brings back highlighting of search results which is a style rule that
was lost in the building of the openstackdocstheme.

We probably also want sidebar integration of this search field,
however this will at least mean hitting the search.html page will do
what people previously expected.

Change-Id: I747ad28658e12441ccad7081d15788f5d738dc5e
This commit is contained in:
Sean Dague 2017-08-11 14:12:24 -04:00 committed by Anne Gentle
parent 1c5afaba7b
commit a5ceb6f15d
5 changed files with 53 additions and 3 deletions

View File

@ -93,5 +93,6 @@ ga('send', 'pageview');
</div>
{% include 'footer.html' %}
{% include 'script_footer.html' %}
{% block script_footer %}{% endblock %}
</body>
</html>

View File

@ -13,6 +13,23 @@
<!-- Popovers -->
<script type="text/javascript" src="{{pathto('_static/js/webui-popover.js', 1)}}"></script>
<!-- standard sphinx include libraries, which allow search highlighting -->
<script type="text/javascript" src="{{pathto('_static/underscore.js', 1)}}"></script>
<script type="text/javascript" src="{{pathto('_static/doctools.js', 1)}}"></script>
<script type="text/javascript" src="{{pathto('_static/searchtools.js', 1)}}"></script>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '{{ version }}',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
SOURCELINK_SUFFIX: '.txt',
HAS_SOURCE: true
};
</script>
<!-- Javascript for page -->
<script language="JavaScript">
/* build a description of this page including SHA, source location on git repo,

View File

@ -21,8 +21,23 @@
</p>
</div>
<p>
{% trans %}To search the OpenStack documentation, type your query into the
{% trans %}To search the documentation for {{ project }}, type your query into the
box below and press Enter.{% endtrans %}
</p>
{% include 'swiftype_search.html' %}
<form action="" method="get">
<input type="text" name="q" value="" />
<input type="submit" value="search" />
<span id="search-progress" style="padding-left: 10px"></span>
<div id="search-results">
</div>
{% endblock %}
{% block script_footer %}
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
<script type="text/javascript" id="searchindexloader"></script>
{% endblock %}

View File

@ -1778,7 +1778,7 @@ footer {
.footer-links h3 {
color: #fff;
font-size: 14px;
font-size: 14px;
}
.footer-links ul {
@ -4653,6 +4653,11 @@ img.align-right, .figure.align-right {
margin-right: 0;
}
/* for search result highlighting */
span.highlighted {
background-color: #fbe54e;
}
/*img.align-left {*/
/* display: table;*/
/* margin-left: 0;*/

View File

@ -0,0 +1,12 @@
---
prelude: >
Adds scoped search so that readers can search within project documentation
only.
features:
- |
Adds ability to use the Sphinx search implementation only for the content
for the project, such as nova or keystone. The default settings set the
search scope to within the built version and only for .html files.
- Readers access the search functionality through a link to Search from the
top-most landing page for the project documentation.