[opencms-dev] Lucene Search - Show some text of the document

M Butcher mbutcher at grcomputing.net
Wed Sep 10 04:43:02 CEST 2003


IIRC, you can use doc.get("body") to get the entire body.

Also, IIRC, it would be doc.score() not hits.score().

Matt

On Tue, 2003-09-09 at 04:03, Oliver Mauckner wrote:
> Hello
> 
>  
> 
> I want some text of the found files to be shown in my search results!
> 
>  
> 
> Here is part of my search.jsp
> 
>  
> 
> 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>");
> 
>         }
> 
>  
> 
> Does anybody know why my score is not working?
> 
> There is only null shown in the results!
> 
>  
> 
> There has to be a function to get some text of the found document!
> 
>  
> 
> Thanx
> 
>  
> 
> Oliver
-- 
M Butcher <mbutcher at grcomputing.net>



More information about the opencms-dev mailing list