[xwiki-users] Show Lucene Search Results in same Space
Hi All, I am testing around with the Lucene Search, all works well, one problem remains: I search in Space A. My search results however, are shown in the Main Wiki Page. This has a different look and feel, and since I do not want to have confused users, I would like to display the search results in the same Space as where the User was was in when he-she started the search. I am guessing its only a one line change in some form, but I cant seem to find it, I hope someone can help me out.. Thanks in advance, Wouter
Hi, You can send the space parameter so that the search results are displayed for the current space. Updating the search form under the #globallinks section on the global.vm template should do the trick: <input type="hidden" name="space" value="$doc.space"/> You can also take a look at http://platform.xwiki.org/xwiki/bin/view/DevGuide/Skins#HD.OverridingtheSkin... on how to override templates in the skin. Hope this helps, Oana On 04/01/2011 04:35 PM, Wouter de Vos wrote:
Hi All,
I am testing around with the Lucene Search, all works well, one problem remains:
I search in Space A. My search results however, are shown in the Main Wiki Page. This has a different look and feel, and since I do not want to have confused users, I would like to display the search results in the same Space as where the User was was in when he-she started the search. I am guessing its only a one line change in some form, but I cant seem to find it, I hope someone can help me out..
Thanks in advance,
Wouter _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Hi Oana I tried your solution but of no avail, I overrode the global.vm, but results are still the same. I tried to give the search results page no parents, so it would appear in my Space A, this works with the breadcrumbs, but the panels change to the panels used on the Main. This makes sense since the URL still links to bin/view/Main, as oppose to bin/view/Space A where I want it to link to. What am I missing out on? I have my search bar in the header, but why does it show the results in a different Space then where I started my search from? Thanks for your help, I am sure there is way to solve this... Wouter On 4/1/11, Elena-Oana Tabaranu <oana.tabaranu@xwiki.com> wrote:
Hi,
You can send the space parameter so that the search results are displayed for the current space. Updating the search form under the #globallinks section on the global.vm template should do the trick: <input type="hidden" name="space" value="$doc.space"/> You can also take a look at http://platform.xwiki.org/xwiki/bin/view/DevGuide/Skins#HD.OverridingtheSkin... on how to override templates in the skin.
Hope this helps, Oana
On 04/01/2011 04:35 PM, Wouter de Vos wrote:
Hi All,
I am testing around with the Lucene Search, all works well, one problem remains:
I search in Space A. My search results however, are shown in the Main Wiki Page. This has a different look and feel, and since I do not want to have confused users, I would like to display the search results in the same Space as where the User was was in when he-she started the search. I am guessing its only a one line change in some form, but I cant seem to find it, I hope someone can help me out..
Thanks in advance,
Wouter _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Hi Wouter, I hope I have understood what you would like to do with the search results: if you add a space parameter to the request generated by the search form in the header, your URL should look something like: http://localhost:8080/xwiki/bin/view/Main/Search?space=Main&text=test This should display only results in the Main space, but has no effect on the live suggestions. Oana On 4/1/11 6:05 PM, Wouter de Vos wrote:
Hi Oana
I tried your solution but of no avail, I overrode the global.vm, but results are still the same. I tried to give the search results page no parents, so it would appear in my Space A, this works with the breadcrumbs, but the panels change to the panels used on the Main. This makes sense since the URL still links to bin/view/Main, as oppose to bin/view/Space A where I want it to link to. What am I missing out on? I have my search bar in the header, but why does it show the results in a different Space then where I started my search from?
Thanks for your help, I am sure there is way to solve this...
Wouter
On 4/1/11, Elena-Oana Tabaranu<oana.tabaranu@xwiki.com> wrote:
Hi,
You can send the space parameter so that the search results are displayed for the current space. Updating the search form under the #globallinks section on the global.vm template should do the trick: <input type="hidden" name="space" value="$doc.space"/> You can also take a look at http://platform.xwiki.org/xwiki/bin/view/DevGuide/Skins#HD.OverridingtheSkin... on how to override templates in the skin.
Hope this helps, Oana
On 04/01/2011 04:35 PM, Wouter de Vos wrote:
Hi All,
I am testing around with the Lucene Search, all works well, one problem remains:
I search in Space A. My search results however, are shown in the Main Wiki Page. This has a different look and feel, and since I do not want to have confused users, I would like to display the search results in the same Space as where the User was was in when he-she started the search. I am guessing its only a one line change in some form, but I cant seem to find it, I hope someone can help me out..
Thanks in advance,
Wouter _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Oana Tabaranu
On 04/01/2011 03:35 PM, Wouter de Vos wrote:
Hi All,
I am testing around with the Lucene Search, all works well, one problem remains:
I search in Space A. My search results however, are shown in the Main Wiki Page. This has a different look and feel, and since I do not want to have confused users, I would like to display the search results in the same Space as where the User was was in when he-she started the search. I am guessing its only a one line change in some form, but I cant seem to find it, I hope someone can help me out..
By default the search feature is implemented as a wiki documents like all the others, you can edit it, rename it, move it to another space. This means that all search results are displayed in the same document, Main.Search, it's not a virtual pseudo-page that works in all spaces. You could, however, proxy the search from a velocity template applied to the current space. You can put this content in a file named "search.vm": #set ($doc = $xwiki.getDocument('Main.Search')) #set ($cdoc = $doc) #set ($tdoc = $doc) #template('contentview.vm') You should upload it as an attachment to the current skin document (by default that's XWiki.DefaultSkin), but if you have more than one skin, one for each space, you could also put it on the server in webapps/xwiki/templates This template allows to display the search results in the URL of another document. Then you should edit the file webapps/skins/colibri/global.vm, locate the search form, and replace the following: <div id="globallinks"> <form action="#if($xwiki.exists('Main.Search'))$xwiki.getURL('Main.Search')#else$xwiki.getURL('Main.WebSearch')#end"> <div class="globalsearch"> <label class="hidden" for="headerglobalsearchinput"> ==> <div id="globallinks"> <form action="$doc.getURL()"> <div class="globalsearch"> <input type="hidden" name="viewer" value="search" /> <label class="hidden" for="headerglobalsearchinput"> The changed file can be uploaded as an attachment to the skin document as well, or it can be left in place (but leaving it there makes upgrades harder, since you have to remember to merge this change back when upgrading). This change makes searching from the searchbox located in the header to display results in the current page. Then you have to edit the Main.LuceneSearch document and replace the following: <form action="$doc.getURL('view', 'viewer=search')"> <div class="globalsearch"> <label class="hidden" for="headerglobalsearchinput"> ==> <form action="$doc.getURL('view', 'viewer=search')"> <div class="globalsearch"> <input type="hidden" name="viewer" value="search" /> <label class="hidden" for="headerglobalsearchinput"> This change makes refining the search terms from the results view display properly in the same document. -- Sergiu Dumitriu http://purl.org/net/sergiu/
Hi Sergiu, Thanks so much it did the trick, it took me a while (as a learning by doing person) but it works excellent! The only thing I did not get done was the change in the Main.LuceneSearch document, the lines I need to replace are not there, so I dont know where to put it. Ideas? Am I looking at the wrong document? -Wouter On 4/2/11, Sergiu Dumitriu <sergiu@xwiki.com> wrote:
On 04/01/2011 03:35 PM, Wouter de Vos wrote:
Hi All,
I am testing around with the Lucene Search, all works well, one problem remains:
I search in Space A. My search results however, are shown in the Main Wiki Page. This has a different look and feel, and since I do not want to have confused users, I would like to display the search results in the same Space as where the User was was in when he-she started the search. I am guessing its only a one line change in some form, but I cant seem to find it, I hope someone can help me out..
By default the search feature is implemented as a wiki documents like all the others, you can edit it, rename it, move it to another space.
This means that all search results are displayed in the same document, Main.Search, it's not a virtual pseudo-page that works in all spaces.
You could, however, proxy the search from a velocity template applied to the current space.
You can put this content in a file named "search.vm":
#set ($doc = $xwiki.getDocument('Main.Search')) #set ($cdoc = $doc) #set ($tdoc = $doc) #template('contentview.vm')
You should upload it as an attachment to the current skin document (by default that's XWiki.DefaultSkin), but if you have more than one skin, one for each space, you could also put it on the server in webapps/xwiki/templates
This template allows to display the search results in the URL of another document.
Then you should edit the file webapps/skins/colibri/global.vm, locate the search form, and replace the following:
<div id="globallinks"> <form action="#if($xwiki.exists('Main.Search'))$xwiki.getURL('Main.Search')#else$xwiki.getURL('Main.WebSearch')#end"> <div class="globalsearch"> <label class="hidden" for="headerglobalsearchinput">
==>
<div id="globallinks"> <form action="$doc.getURL()"> <div class="globalsearch"> <input type="hidden" name="viewer" value="search" /> <label class="hidden" for="headerglobalsearchinput">
The changed file can be uploaded as an attachment to the skin document as well, or it can be left in place (but leaving it there makes upgrades harder, since you have to remember to merge this change back when upgrading).
This change makes searching from the searchbox located in the header to display results in the current page.
Then you have to edit the Main.LuceneSearch document and replace the following:
<form action="$doc.getURL('view', 'viewer=search')"> <div class="globalsearch"> <label class="hidden" for="headerglobalsearchinput">
==>
<form action="$doc.getURL('view', 'viewer=search')"> <div class="globalsearch"> <input type="hidden" name="viewer" value="search" /> <label class="hidden" for="headerglobalsearchinput">
This change makes refining the search terms from the results view display properly in the same document. -- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
participants (4)
-
Elena-Oana Tabaranu -
Oana Tabaranu -
Sergiu Dumitriu -
Wouter de Vos