[opencms-dev] search xmlcontent

Claus Priisholm cpr at codedroids.com
Thu Apr 26 15:53:10 CEST 2007


The first step is to make sure the Lucene index actually support the 
kind of query you want to make. I.e. the contents of the specific tags 
from your xmlcontent must be present in a separate Lucene index field. 
Per default OpenCms extracts all text from the contents and put into the 
contents field in the Lucene index, so you cannot limit the search to 
only look at specific parts of the xmlcontens.

In v. 6 this means creating a new class for handling the indexing of the 
specific types of xmlcontents (and set it in the opencms-search.xml).
In v. 7 you can map fields via the configuration, so you can most likely 
avoid the step of making a specific class for the indexing (unless you 
have explicit needs as far as controlling exactly how each field is 
analyzed, tokenized, indexed...)

Once the Lucene index holds the appropriate information then you must 
define your query such that it only looks at the appropriate fields 
(instead of the generic contents field).

This is mostly Lucene stuff, the OpenCms API hides some of the OpenCms 
specifics, but you'll need to have an idea of how Lucene works.

Detlef Beyer wrote:
> Hello again!
> 
> nobody has an idea how to solve this problem? I checked the forum and mail archive and found no solution?!
> There must be a way to limit the lucene search to specific fields of the xml documents... :(
> 
> Please!
> 
> Detlef
> 
>> I'm trying to limit a search in xmlcontent files to include only some of the elements (fields) of my custom XML types. Searching only xmlcontent works - but the result includes all fields.
>> I found no way to use the opencms-search.xml for the configuration of this feature. I defined an indexsource with the documenttype "xmlcontent" - but there is no entry to specify the fields to search in?!
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 

-- 
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
--
Javadocs and other OpenCms stuff: 
http://www.codedroids.com/community/opencms



More information about the opencms-dev mailing list