[opencms-dev] Lucene - Searchable fields

Trevor Lee Trevor.Lee at 4Loop.com.au
Wed Nov 26 22:39:01 CET 2003


Hi Matt,

I'm trying to integrate a Highlighting text tool with the search results -
which requires the body to be retrieved from the Document object.

What is the method that should be used from the OpenCMS api given the
Document object to retrieve the body? (Assuming i don't change the
*Document.java files as you suggested)

Thanks : )

Cheers
Trevor

-----Original Message-----
From: opencms-dev-admin at opencms.org
[mailto:opencms-dev-admin at opencms.org]On Behalf Of M Butcher
Sent: Wednesday, November 26, 2003 5:28 PM
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] Lucene - Searchable fields



"body" is the correct doc object. The body is put in an UnStored Field,
which, according to the Javadocs for Lucene:

"Constructs a String-valued Field that is tokenized and indexed, but
that is not stored in the index."

Body was implemented this way because there is no point in storing the
entire body of a document in the index when it can easily be fetched
through the OpenCms API.... I guess I should say, because _I_ couldn't
see a point in storing the entire body. You may be able to think of a
perfectly good reason. ;-)

If, for some reason, you decide you need to change from an unstored to
some other type of Field, you would need to change each of the
*Document.java classes that index bodies (e.g. no need to touch
BodylessDocument.java) and recompile (etc.). Shouldn't be bad, though,
since it only requires a one-line change per file.

Matt

Trevor Lee wrote:
> Hi,
>
> I was wondering what the searchable fields are?
>
>>From the simple_search.jsp:
> Last modified date is last_modified (ie doc.get("last_modified"))
> title is title
>
> what is the corresponding value for body?
> I've tried doc.get("body") and doc.get("text") and both seems to return
> null. But the doc.get("title") works ok for the corresponding doc object.
>
> If anyone has any ideas it would be much appreciated.
>
> Cheers
> Trevor
>
>
> _______________________________________________
> 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