[opencms-dev]restrictingsearchwithorg.opencms.search.CmsSearch.setSearchRoot-shouldthismethodwork?

Olli Aro olli_aro at yahoo.co.uk
Thu May 3 10:47:54 CEST 2007


Yes I did guess you would say that, but thought I will try anyway ;D

Anyway, thanks for your help and for confirming that the method does work.

Regards,

Olli

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Alexander Kandzior
Sent: 03 May 2007 09:41
To: 'The OpenCms mailing list'
Subject: RE:
[opencms-dev]restrictingsearchwithorg.opencms.search.CmsSearch.setSearchRoot
-shouldthismethodwork?

Unfortunatly I don't have the time to debug your code.

To verify if the feature works in your installation, you could try the
search function in the "Seach Management" GUI of the Workplace
"Administration" view. You can set an optional "Search folder" here, which
using the search root function. 

Best,

Kind Regards,
Alex.
 
-------------------
Alexander Kandzior
                                                               
Alkacon Software GmbH  - The OpenCms Experts                  
http://www.alkacon.com - http://www.opencms.org                 

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
> Sent: Thursday, May 03, 2007 10:00 AM
> To: 'The OpenCms mailing list'
> Subject: RE: 
> [opencms-dev]restrictingsearchwithorg.opencms.search.CmsSearch
.setSearchRoot-shouldthismethod work?
> 
> Hi Alex,
> 
> Sorry to bother you again but I just cannot get this working. 
> Would you have
> a quick look at the code below and tell me what I am doing 
> wrong? It is
> basically the default search code from TemplateOne and I have 
> then just
> customized it to add the searchRoot.
> 
> Thanks,
> 
> Olli
> 
> ---
> 
> <%@ page session="false" buffer="none"
> import="java.util.*,org.opencms.search.*,org.opencms.frontend.
templateone.*,
> org.opencms.util.*" %><%--
> This is the search code page.
> --%><%
> // initialise the template bean
> CmsTemplateSearch cms = new CmsTemplateSearch(pageContext, request,
> response);
> 
> String searchRoot="/";
> if(request.getParameter("uri")!=null)
> 	 searchRoot=request.getParameter("uri");
> %><%--
> --%><jsp:useBean id="search" scope="request"
> class="org.opencms.search.CmsSearch"><%--
> --%><jsp:setProperty name="search" property="*"/><% 
>     	search.init(cms.getCmsObject());
>     	search.setMatchesPerPage(10);
>     	search.setQueryLength(3);
>     	search.setDisplayPages(11);
>     	search.setSearchRoot(searchRoot);
>     	search.init(cms.getCmsObject()); %><%--
> --%></jsp:useBean><%--
> --%>Olli debug: <%= search.getSearchRoots()[0] %>
> 						<div id="searchpage">
> 							<div
> id="searchpageform">
> 								<h3
> title="Search again?"><label for="searchagainsearch"><span>Search
> again?</span></label></h3>
> 								<form
> name="searchform" id="searchagainsearch" method="get" action="<%=
> cms.link(searchRoot+"search.html") %>" onsubmit="return
> parseSearchQuery(document.forms['searchform'], '<%=
> cms.key("search.error.wordlength") %>');">
> 	
> <fieldset>
> 	
> <legend title="Type your search keywords and press 'SEARCH'"
> class="hidden">Type your search keywords and press "Search"</legend>
> 	
> <label for="searchagainkeywords" class="hidden">Keywords here:</label>
> 	
> <input type="hidden" name="action" value="search" />
> 	
> <input type="hidden" name="query" value="" />
> 	
> <input type="hidden" name="index" value="Online project (VFS)" />
> 	
> <input type="hidden" name="searchPage" value="1" />
> 	
> <input type="hidden" name="<%= CmsTemplateBean.PARAM_URI %>" 
> value="<%=
> searchRoot %>" />
> 	
> <input type="hidden" name="__locale" value="<%=
> cms.getRequestContext().getLocale() %>" />
> 	
> <input class="searchinput" type="text" id="searchagainkeywords"
> name="query2" value="<%= 
> CmsStringUtil.escapeHtml(search.getQuery()) %>"
> onfocus="this.value=''" />
> 	
> <input class="searchsubmit" type="submit" value="<%= 
> cms.key("link.search")
> %>" /><br />
> 
> <%
> if (cms.isSearchAllDisplayed()) {
> %>
> <br />
> 	
> <input type="checkbox" name="<%= CmsTemplateSearch.PARAM_SEARCHALL %>"
> value="true"<%= cms.getSearchAllChecked() %>>
> 			<%= cms.key("search.text.all") %><%
> }
> %>
> </fieldset>
> 								</form>
> 							</div>
> 							<div
> id="searchpageresult">
> <%
> // get the search results for the page
> List result = cms.getSearchResults(search);
> out.print(cms.buildSearchErrorMessages(search, result));
> if (result != null && result.size() > 0) {
> 	// show the result list
> 	out.print(cms.buildSearchResultList(result));
> 	// show the links to other result pages
> 	out.print(cms.buildSearchLinks(search));	
> }
> %>
> 							</div>
> 						</div>
> 
> ---
> 
> 
> 
> 
> 
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of 
> Alexander Kandzior
> Sent: 02 May 2007 15:27
> To: 'The OpenCms mailing list'
> Subject: RE:
> [opencms-dev]restrictingsearchwithorg.opencms.search.CmsSearch
.setSearchRoot
> - shouldthismethod work?
> 
> Yes, this is the expected behaviour. 
> 
> Kind Regards,
> Alex.
>  
> -------------------
> Alexander Kandzior
>                                                                
> Alkacon Software GmbH  - The OpenCms Experts                  
> http://www.alkacon.com - http://www.opencms.org                 
> 
> 
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> 


_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list