[opencms-dev] Lucene doesn't seem to work!

Hartmann, Waehrisch & Feykes GmbH hartmann at waehrisch-feykes.de
Thu Feb 12 08:38:00 CET 2004


What's the exact output when you call the search page?

----- Original Message ----- 
From: "Steffen Valentin" <sva at archikart.de>
To: <opencms-dev at opencms.org>
Sent: Thursday, February 12, 2004 8:18 AM
Subject: Re: [opencms-dev] Lucene doesn't seem to work!


> The logfile says it has indexed 723 files!
>
> And here is the search jsp - I call it from another page via form with the
> parameter q
>
> <%@ page import="net.grcomputing.opencms.search.lucene.SearchHelper,
> org.apache.lucene.search.Hits,
>     org.apache.lucene.document.*, com.opencms.flex.jsp.*, java.util.Date"
%>
>
> <%
> CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
> response);
>
> // This class has a bunch of useful methods for searching.
> SearchHelper search = new SearchHelper(cms);
>
> // Get the GET/POST parameter named "q"
> String query = request.getParameter("q");
> if(query != null) {
>     // This does a text search using the query provided.
>     // org.apache.lucene.hits are returned.
>     Hits hits = search.doSimpleSearch(query);
>     //out.println("Hits");
>
>     int i, j = hits.length();
>
>     if(j == 0) {
>         out.println("<h2>Your search found no matches. Please try
> again.</h2>");
>     } else {
>         float score;
>         Document doc;
>         String tLastMod;
>         if(j == 1)
>             out.println("<h2 class=\"search-mathces\">Your search found 1
> match.</h2>");
>         else
>             out.println("<h2 class=\"search-matches\">Your search found "
+
> Integer.toString(j) + " matches.</h2>");
>
>         // For each hit, get the Document and print out some information
> (including a link) about each item that
>         // matches.
>         for(i = 0; i<j; ++i) {
>             score = hits.score(i);
>             doc = hits.doc(i);
>             String lms = doc.get("last_modified");
>             if(lms != null && !"".equals(lms))
>                 tLastMod = DateField.stringToDate(lms).toString();
>             else tLastMod = "unknown";
>
>             //tLastMod = "unknown";
>             out.println("<p class=\"search-hit\"><b
> class=\"search-hit-title\">"
>                 + "<a href=\"" + cms.link(doc.get("abs_path")) + "\"
> class=\"search-hit-link\">"
>                 + doc.get("title") + "</a></b><br><i
> class=\"search-hit-score\">");
>             //out.print(score); // Score is between 0.0 and 1.0
>             out.println("</i> " + doc.get("description") + " <br><span
> class=\"smalltext\">(Last modified: " + tLastMod + ")</span></p>");
>         }
>     }
> } else {
>     out.println("No results found.");
> }
>
> %>
>
> ----- Original Message -----
> From: "Ben Rometsch" <ben at solidstategroup.com>
> To: <opencms-dev at opencms.org>
> Sent: Wednesday, February 11, 2004 4:22 PM
> Subject: Re: [opencms-dev] Lucene doesn't seem to work!
>
>
> > Can you post the search jsp file?
> >
> > Hartmann, Waehrisch & Feykes GmbH wrote:
> >
> > >does the logfile say that it has indexed n files?
> > >how did you call the simple_search.jsp? If you call it directly with
your
> > >browser, you must append a query string:
> > >simple_search.jsp?q=searchterm
> > >
> > >Regards,
> > >Stephan
> > >
> > >
> > >----- Original Message -----
> > >From: Steffen Valentin
> > >To: opencms-dev at opencms.org
> > >Sent: Wednesday, February 11, 2004 2:09 PM
> > >Subject: [opencms-dev] Lucene doesn't seem to work!
> > >
> > >
> > >Hello everybody!
> > >
> > >I've installed the Lucene search module and indexed my files in
OpenCms.
> > >According to the logfile this worked so far.
> > >
> > >But now when using the simple_search.jsp which was shipped with the
> modul,
> > >the result was that nothing has been found!
> > >
> > >Does anybody have the same problem and what might be wrong?
> > >
> > >
> > >Thank you in advance!
> > >
> > >Bye Steffen
> > >
> > >_______________________________________________
> > >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
> > >
> > >
> > >
> > >
> >
> > --
> > ----== Solid State Group ==----
> > Web     www.solidstategroup.com
> > Email   ben at solidstategroup.com
> > MSN     benrometsch at hotmail.com
> >
> > _______________________________________________
> > 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
> >
> >
>
> _______________________________________________
> 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




More information about the opencms-dev mailing list