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
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>
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.