[opencms-dev] Is the search module usable at all?

Nigel Kersten nigel at cofa.unsw.edu.au
Tue Apr 4 00:56:11 CEST 2006


On 04/04/2006, at 7:19 AM, Volker Goetz wrote:

> I recreated the indices.
>
> Seraching in either of the indices from the Administration view  
> works as
> expected. But I can view the documents from the search result only  
> when I
> select '/' as the project in the workplace.
>
> In a jsp page in my site MySite, I loop through all available search
> indices using the same hardcoded search string for all iterations.  
> None of
> the indices yield any result.
>
> So far for now. I have given up, the search module in its current  
> state is
> just useless for me.

Search is definitely working for me in 6.2 beta. Here are some  
snippets now in case they help.

from opencms-search.xml

             <index>
                 <name>COFA All</name>
                 <rebuild>auto</rebuild>
                 <project>Online</project>
                 <locale>en</locale>
                 <sources>
                     <source>sourcecofaall</source>
                 </sources>
             </index>

and

             <indexsource>
                 <name>sourcecofaall</name>
                 <indexer class="org.opencms.search.CmsVfsIndexer"/>
                 <resources>
                     <resource>/sites/cofa/</resource>
                 </resources>
                 <documenttypes-indexed>
                     <name>xmlpage</name>
                     <name>xmlcontent</name>
                     <name>text</name>
                     <name>pdf</name>
                     <name>rtf</name>
                     <name>html</name>
                     <name>msword</name>
                     <name>msexcel</name>
                     <name>mspowerpoint</name>
                     <name>image</name>
                     <name>generic</name>
                 </documenttypes-indexed>
             </indexsource>


and my jsp element that does the searching looks like:

<%@ page buffer="none" import="org.opencms.main.*,  
org.opencms.search.*, org.opencms.file.*, org.opencms.jsp.*,  
java.util.*" %>
<%
   org.opencms.jsp.CmsJspActionElement cms = new CmsJspActionElement 
(pageContext, request, response);
   CmsSearchManager searchManager = OpenCms.getSearchManager();
%>

<jsp:useBean id="search" scope="request"  
class="org.opencms.search.CmsSearch">
   <jsp:setProperty name = "search" property="*"/>
   <% search.init(cms.getCmsObject());
     search.setIndex("COFA All");
   %>
</jsp:useBean>

<form method="post" action="/search" onsubmit="return parseSearchQuery 
(document.forms['searchhead'], 'The search word must have at least  
three characters!');" id="searchhead">
   <fieldset>
    <input type="text" value="Search all of COFA" name="query" id="s"  
class="text" /><label for="s">Search</label>
     <input type="submit" value="Search" class="submit" />	
     <input type="hidden" name="index" value="COFA All" />
     <input type="hidden" name="action" value="search" />
     <%
       if (request.getParameter("uri") != null) {
         out.println("<input type=\"hidden\" name=\"uri\" value=\"" +  
request.getParameter("uri") + "\" />");
       } else {
         out.println("<input type=\"hidden\" name=\"uri\" value=\"" +  
request.getPathInfo() + "\" />");
       }
     %>
     <input type="hidden" name="__locale" value="<%=  
cms.getRequestContext().getLocale() %>" />
     <input type="hidden" name="query" value="" />
     <input type="hidden" name="page" value="1" />
   </fieldset>
</form>




-- 
Nigel Kersten [Senior Technical Officer]
College of Fine Arts, University of NSW, Australia.
CRICOS Provider Code: 00098G






More information about the opencms-dev mailing list