- Get started with theme development
- Gulp Viewport and Developer tools
- Theme development troubleshooting
- Password-protect content for anonymous users
- Advanced content rendering
- Develop Pluggable Placeholders
- Get help with theme development
- Page context
- Blog overview context
- Search context
- Error context
- Supported macros
- Theme guidelines
- Theme properties
- Search and SEO
- Confluence/Viewport macros and features
- (External) files and media
- Integration with other Scroll Add-ons
Integration with third-party software
- Displaying Additional User Information from the User Profile Plugin
- General 3rd party add-on implementation
- Integrating Disqus Comments
- Making Gliffy macros resizable
- Making UI-Expand macro of RefinedToolkit work
- Displaying Viewport Content in an iframe
- Integrate Midoris Archiving Plugin
- Trigger EliteSofts Page View Macro through Scroll Viewport
- Make your app compatible with Scroll Viewport
- Content Management via Page properties
- Context-Sensitve Help
By default, Scroll Viewport uses the standard Confluence search functionality. Therefore, if you search with multiple strings, Confluence will do an OR-Search by default. For example, if you search for 'Scroll Viewport' the search will find results for 'Scroll' 'Viewport' and 'Scroll Viewport'. As a result, this search process might include some results that you are not looking for.
However, to perform an AND-Search in Confluence, you can simply wrap your string in double quotation marks, like this "Scroll Viewport". Using this process, means you will only get results which contain 'Scroll Viewport'.
This article will explain how you can setup AND-search in your Viewport without having to add double quotation marks to your search term(s). This article is using the Scroll Web Help Theme as a base.
What you need
Changing the search from OR-search to AND-search
- Open your Theme in the Theme Editor
- Navigate to assets > js > scroll-search.js
- Change the following on line 10:
var url = 'q="' + query + '"&s=*&max=5';
q= and before the
&s we need to add double quotation marks. This will wrap the given query and the Confluence Search will perform an AND-Search.
Additionally, it is necessary to do the same for the quick-search on line 49 in the same file:
var url = $('form#search').attr('action') + '?q="' + query + '"&s=*&max=7';
Since these changes will affect the displayed search terms on your results page, we also need to remove the double quotation marks from the velocity template. To do this:
- Navigate to include > include-search.vm
- Implement the following change on line 30:
<h1 class="search-header">Search for <em>$searchRequest.queryString</em>
$searchRequest.queryString is wrapped in double quotation marks which needs to be removed.
Your Confluence search is now performing an AND-Search by default in your Viewport.