[All Adaptavist Apps]
I didn't found any macro that give this very nice function : the new quick search since Confluence 2.10.
I have created the next macro
<form id="quick-search" method="get" action="/confluence/dosearchsite.action">
<fieldset>
<input id="quick-search-query" style="color: black;" type="text" accessKey="q" autocomplete="off" name="queryString" size="20"/>
<input type="checkbox" name="searchQuery.spaceKey" value="$space.getKey()" > </input>
<font size="1" color="white" valign=middle >space only </font>
</fieldset>
<fieldset class="hidden parameters">
<input type="hidden" id="quickSearchPlaceholder" value="Search">
<input type="hidden" id="quickNavEnabled" value="true">
<!-- Quick nav disabled. SettingsManager could not be found --> </fieldset>
</form>
It must be created without body and with output html.
I added a checkbox to restrict the search to the current space.
This macro only works in the header of a theme.
This can perhaps help somebody.
But perhaps is there something easier?
Thanks for your ideas.
7 Comments
Unknown User (amoran)
{builder-search} is probably going to be easier
Unknown User (mmartineau)
Thank you Alain
It will be really easier.
When do you plan this very useful macro?
Unknown User (amoran)
A little over nine months ago
In builder terms - from builder 3.3.3 onwards, however later releases have fixes to make drop area position itself correctly, some of which depend on your confluence version as the goalposts moved a couple of times since 2.10
Unknown User (scayla)
Pay attention to the fact that this macro cannot be restricted to the current space as no parameter can be specified, and you cannot have 2 search bars in the same page (sometimes useful for a dashboard for example)
It's possible to have the macro restricted for a space with a checkbox but you'll have to modify the general search macro of confluence since
builder-search
uses this search function.Unknown User (amoran)
In fact, builder-search is just a pass-through to the confluence default search box implementation, so any restrictions/bugs you find in that code will be present in builder-search as well.
Unknown User (scayla)
Instead of modifying/adding the code in macros.vm, one way to make the search find something in the current space can be to create a user macro which displays the content of quick-search.vm (with the useful jQuery function to add the dropdown results), replacing the call to the
#quickSearch()
function by the actual velocity content of the function, and add the checkbox to only search in the current space.However, ticking the checkbox will have no effect on the live dropdown results.
Unknown User (mmartineau)
Steeve,
The code I have furnished display only a searchbox. The checkbox update the searchQuery.spaceKey parameter that specify the space. I founded this parameter in a patch documentation on Internet (I didn't remember where) that allows to restrict the search for the space which the wiki user is browsing. The code is tested and it works (Confluence 2.10).
Thanks for your attention Steeve.