[opencms-dev] Custom collector with parametrized search

Steve Bryan steve at bright-interactive.com
Fri Mar 14 11:08:56 CET 2008


Hi

You can maybe use Lucene to do your searches without customizing
CmsSearchIndex. In OpenCms 7 you can map elements and properties of XML
objects to fields in Lucene, using the <fieldconfiguration> in
opencms-search.xml. 

See Alkacon documentation:
/alkacon-documentation/documentation_search/configuration_fields.html

Define a new index for your structured content, then apply a field
configuration to it, to map elements and properties of the xml to lucene
fields. You will need to add the fields for searching as indexed fields, and
fields you want to display as stored fields.

Then you can search over the index using the usual Lucene syntax eg
'title:This AND category:That'.

OpenCms will return CmsSearchResult objects that you can use instead of the
collector method. 

I have used this method widely on a site and it is very performant for
searching over hundreds of data items.

Steve


-----Original Message-----

Date: Thu, 13 Mar 2008 13:44:10 +0100
From: Juan Francisco Fern?ndez Rodr?guez 	<juanffernandez at faffe.es>
Subject: Re: [opencms-dev] Custom collector with parametrized search
To: "'The OpenCms mailing list'" <opencms-dev at opencms.org>
Message-ID: <007001c88507$ef88bbc0$b000a8c0 at faffe.es>
Content-Type: text/plain; charset="iso-8859-1"

Thanks Pere, but that solution not fit well in our case, we are a large
foundation (more than 1000 employees), and our resources on OpenCms grow up
very fast, so in some weeks we will have thousands of them.

 

I thought to use that approach at first, but as I said, we will have tons of
resources to search in, and that?s the cause of my idea to use Lucene?s
search engine.

 

Greets!

 
----- Original Message ----- 

From: Juan <mailto:juanffernandez at faffe.es>  Francisco Fern?ndez Rodr?guez 

To: 'The <mailto:opencms-dev at opencms.org>  OpenCms mailing list' 

Sent: Thursday, March 13, 2008 10:08 AM

Subject: [opencms-dev] Custom collector with parametrized search

 

Hi list,

 

In my OpenCms system, I have a custom xmlcontent for news that is displayed
as a list, and now I have to allow the user to filter that list by some
fields of the content (title, country, dates, category, some Boolean fields,
etc.). I?m thinking to extend CmsSearchIndex to rebuild the Lucene?s search
query to perform a search in the fields specified by the user. Is this the
best solution? 

 

If the number of documents is relatively small, as was our case,you can do
it just by defining a standard index on the relevant folder(s), perform the
standard search on the system attributes (i.e. title, keywords, content,
etc) and then filtering the result looking into each document for the other
filter attributes. Not very performant, but simple and not that bad for
small sets.

 

Pere

 






More information about the opencms-dev mailing list