[opencms-dev] Need help to do Search functionality

Achim Westermann a.westermann at alkacon.com
Mon Sep 12 15:42:12 CEST 2005


Hi Navaneetha,

this time the description of your problem exactly matches my suggested cause.

> If i open my workplace with site as "root" ("/") mode.In that situation 
> my search.jsp is working.
> 
> If i open my workplace with site as "/sites/default/" mode my search.jsp 
> is not working.

This behaviour is - by default - totally correct. Imagine if someone has set up a jsp for online 
usage in site "/sites/mysite/" and (due to some configuration problem, configuration change,....) an 
index is searched whose root is above or next to this site.
Users would find pages that are not reachable from their site root. Result links would be dead from 
"/sites/default/".

Furthermore: Never ever store any content in the system folder ("/" root site). Always use 
"/sites/default/" or another self-configured site. The index for the system folder should be 
optional and not contain any important information to search.


At last: In the administration view it may be desireable to search and find everything even from 
every site. Admins may see everything. This is not supported by default. To enable this you could 
modify

/system/workplace/admin/searchindex/search/index.html


Open it in the explorer and change:

<%
     List result = search.getSearchResult();
     if (result == null) {
       ....
%>


to:
<%
     CmsRequestContext context = wp.getJsp().getRequestContext();
     String siteRoot = context.getSiteRoot();
     context.setSiteRoot("");
     List result = search.getSearchResult();
     context.setSiteRoot(siteRoot);
     if (result == null) {
      ....
     }
     //

%>


This would allow your request but is provided without any guarantee...

regards,

Achim



> I want the search function to work even the site is "/sites/default/".
> 
> Please help me to solve this problem.
> 
>  
> 
> regards
> 
> Navaneethan
> 
>  
> 
> ------------------------------------------------------------------------
> Yahoo! India Matrimony <http://yahoo.shaadi.com>: Find your partner now.
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev


-- 
Achim Westermann
-------------------

Alkacon Software
http://www.alkacon.com



More information about the opencms-dev mailing list