Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Helle Markmann August 18, 2017

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)

https://yousee.jira.com/wiki/dosearchsite.action?queryString=word&where=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

Helle

 

1 answer

0 votes
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2017

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.

<script>
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("a.search-for");
moreLink.attr("href", AJS.params.baseUrl + newLink);
}, 500);
});
}
});
});
</script>
Helle Markmann August 20, 2017

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.

Helle

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events