[opencms-dev] Index an XmlContent element

Steve Bryan steve at bright-interactive.com
Thu Apr 3 12:29:16 CEST 2008


Hi Juan

The syntax for mapping elements is slightly strange when you only have one
element (and it doesn't seem to be documented anywhere).

Try <mapping type="item">ElementName[0]</mapping>

ie with '[0]' following the element name. This is actually quite powerful
because it allows you to map multiple element values to one Lucene field
when there are repeating elements, eg

<mapping type="item">ElementName[0]</mapping>
<mapping type="item">ElementName[1]</mapping>
<mapping type="item">ElementName[2]</mapping>

Hope that works for you

Steve


------------------------------

Message: 7
Date: Thu, 3 Apr 2008 10:48:19 +0200
From: Juan Francisco Fern?ndez <juanffernandez at faffe.es>
Subject: [opencms-dev] Index an XmlContent element
To: <opencms-dev at opencms.org>
Message-ID: <000601c89567$77827e70$b000a8c0 at faffe.es>
Content-Type: text/plain; charset="iso-8859-1"

Hi guys, 

 

I want to perform a search using Lucene engine in a custom xmlcontent
created by my own. I want to search only in one field of this content, and I
have tried all the possible configurations in the Search Management tools at
the Admin View. I thouth that I must configure it as this at
opencms-search.xml:

 

<fieldconfiguration>

<name>XmlContentName</name>

<fields>

<field name="ElementName" store="false" index="true">

<mapping type="item">ElementName</mapping>

</field>

</fields>

</fieldconfiguration>

 

Then I assigned this field configuration to an index:

 

<index>

<name>IndexXmlContentName </name>

<rebuild>auto</rebuild>

<project>Online</project>

<locale>es</locale>

<configuration>XmlContentName</configuration>

<sources>

<source>CustomSource</source>

</sources>

</index>

 

And rebuild the index. Then I try to find a Term that appears in
ElementName, at least, on one file of this content type, and no results have
been returned. If I change the mapping type to content, then it returns all
the files that contains the term at any content?s item, so I think the
search is working ok but I have the problem at the field configuration. 

 

Any suggestion?

 

Thanks!

 

Juan Francisco Fern?ndez Rodr?guez
Direcci?n de Organizaci?n y Sistemas. Dpto de Servicios Inform?ticos
FUNDACI?N ANDALUZA FONDO DE FORMACI?N Y EMPLEO
CONSEJER?A DE EMPLEO
Carretera de la esclusa, 11. 
Edificio Galia Puerto. Acceso A.
41011 Sevilla
Tfno.: 954 385 550   Fax: 954 915 119
Correo-e: juanffernandez at faffe.es <blocked::mailto:juanffernandez at faffe.es> 






More information about the opencms-dev mailing list