[opencms-dev] Index an XmlContent element

Sandrine Prousteau s.prousteau at eurelis.com
Thu Apr 3 13:48:54 CEST 2008


Hi Im not expert but make sure you have added
		<documenttype>
                <name>xmlcontent</name>              							<class>org.opencms.search.documents.CmsDocumentXmlContent</class>
                <mimetypes/>
                <resourcetypes>
                    <resourcetype>your-type-xmlcontent</resourcetype>
                </resourcetypes>
            </documenttype> 
In the file /web-inf/config/opencms-search.xml.
And for me, I write, to scann an single item, myItem[1] instead of myItem[0].

-----Message d'origine-----
De : opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] De la part de Juan Francisco Fernández
Envoyé : jeudi 3 avril 2008 13:12
À : 'The OpenCms mailing list'
Objet : Re: [opencms-dev] Index an XmlContent element

Hi Steve,

I have tried that solution, but it doesn't work either. I'm using this
search string (also with [0] at ElementName's end to try your solution):

+root:"root sites faffe desarrollo_de_personas formacion_continua contenido"
+ElementName:term


I have ensured myself that this term exists in the element ElementName of
some content. As I said, if I change the mapping type to "content", this
same search string works fine, so my problem must be in the index field
configuration.

If I look at Edit controlcode of one file in the root field specified, the
ElementName element is there:


<ElementName><![CDATA[term to search]]></ElementName>

PS: Steve, I follow your suggestion in the search content collector, but I
forgot to answer your mail, sorry about that ;). Now, I have the collector
working, but with this index problems.


-----Mensaje original-----
De: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org]
En nombre de Steve Bryan
Enviado el: jueves, 03 de abril de 2008 12:29
Para: opencms-dev at opencms.org
Asunto: Re: [opencms-dev] Index an XmlContent element


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> 




_______________________________________________
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


_______________________________________________
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



More information about the opencms-dev mailing list