Is the livesearch macro parameters not supposed to be used when you press enter

I have a livesearch macro on a page in my space. It only searches the space, and only pages - not showing for example gliffy diagrams or images.

I works very fine, when users type in a word, and wait for the suggestions.

But if the user wants to get more results than just the few listed in the drop down, and either presses carriage return or selects the possibility in the buttom of the list, the query changes.

(searching for 'word' in the space MYSPACE)

So, I would have expected the type=pages in the search. Now the user also gets all images and diagrams, and that confuses, since we have named many diagrams after the page/subject.

Our end users are not necesary it experts and don't understand, the difference between the diagram icon and the page icon. They can not be though to just select Pages as type in left side of the search bar. (we have 2.000 users).

Thank you



1 answer

Hi Helle,

I wrote this short javascript to be able to carry livesearch parameters over to the regular search. You can either install it in the custom HTML and it will take effect on all livesearch macros, or you can put it inside a user macro (with ## @noparams at the top) and put the user macro in the one page for it to take effect only on that page.

AJS.toInit(function() {
$("form[name=livesearchForm]").each(function() {
var labelVal = $(this).find("input[name=labels]").val();
var typeVal = $(this).find("input[name=contentType]").val();
if (labelVal || typeVal) {
$(this).find("input[name=queryString]").on("keyup", function() {
var input = $(this).val();
var livesearchForm = $(this).parent().parent().parent();
var spaceKey = livesearchForm.find("input[name=where]").val();
var newLink = '/dosearchsite.action?cql=siteSearch+~+"' + input + '"';
if (labelVal) {
newLink += '+and+label+%3D+"' + labelVal + '"';
if (typeVal) {
newLink += '+and+type+%3D+"' + typeVal + '"';
if (spaceKey !== "conf_all") {
newLink += "+and+space+%3D+" + spaceKey;
livesearchForm.attr("action", AJS.params.contextPath + newLink);
setTimeout(function() {
var moreLink = livesearchForm.prev().find("");
moreLink.attr("href", AJS.params.baseUrl + newLink);
}, 500);

thanks. I'll try that. I might help some of my problem.

I doesn't make sense to change the search globally. I have a searchbar on my "front page", and hopefully the script will help me there.

My other searchbox is in the header for the space (I made the header in wiki markup in the configuration.

My guess is that in order to make it work, in the header as well, I could make the header as a css in stead?

Again, thanks for the answar.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

715 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you