[opencms-dev] Search on different fields of structured contenttype.

Jonathan Woods jonathan.woods at scintillance.com
Wed Oct 18 14:27:16 CEST 2006


Christoph, Sakshi -
 
The approach below works fine.  You need some way to get past the OpenCms
search interface and into the Lucene API, so I've attached a snippet of code
which gets you a Lucene IndexSearcher from the OpenCms runtime framework.
 
Jon

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Christoph Schönfeld
Sent: 18 October 2006 11:34
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Search on different fields of structured
contenttype.


As far as I understand OpenCms correctly what you want is possible by
providing a custom Lucene Document Factory (which implements
org.opencms.search.documents.I_CmsDocumentFactory) as part of your own
custom OpenCms Document Type class. Your implementation of the interface
method "org.opencms.search.documents.I_CmsDocumentFactory.newInstance(cms:
CmsObject, resource: A_CmsIndexResource, language: String):
org.apache.lucene.document.Document" should be able to add the custom fields
you need to the returned Lucene Document.

This class has probably to appear as the "Document type class" in the search
index source frontend (Administration View >  Search Management >  View
index sources >  Index source overview). 

See org.opencms.search.documents.CmsDocumentXmlPage for an example of such a
class. It extends A_CmsVfsDocument which implements the afore mentioned
interface.

I plan to use this approach for my own project, though I did not yet
validate it and I do not yet know how to build the customized search on top
of it.


Christoph



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20061018/55fe56a9/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: snippet.txt
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20061018/55fe56a9/attachment.txt>


More information about the opencms-dev mailing list