[opencms-dev] Configuring which xmlcontent fields to search

Andreas Zahner a.zahner at alkacon.com
Tue Apr 27 12:53:32 CEST 2010


Hi Paul,

another option is to use the <xsd:appinfo> section to exclude specific 
XML content elements, available since version 7.0.2:

<xsd:annotation>
   <xsd:appinfo>
     ...
     <searchsettings>
       <searchsetting element="${ELEMENTNAME}" searchcontent="false" />
       ...
     </searchsettings>
     ...

Just try it for your content.

-- 
Regards,
Andreas.

-------------------
Andreas Zahner

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com -  http://www.opencms.org

Paul-Inge Flakstad schrieb:
> Hi Mario,
> 
> Thanks a lot for your reply, I wouldn't have thought of that myself. :)
> 
> You are suggesting to create a single searchable string, that is a concatenation of the elements I want to search, and use it as a substitute for the default extracted xmlcontent string, am I right?
> 
> I have a few concerns though:
> 1.) That property will, in some cases, contain a LOT of content. Is there any limit on the string length?
> 2.) Will I be able to map the repeating, nested "Paragraph" element properly? (It too contains other nested elements.)
> 3.) Since the "standard" field configuration would normally do just fine if I could only exclude an element or two, this seems like a lot of trouble to go through. (I have several xmlcontent resource types that would need this kind of handling.) I can't help but think that it would be easier to tell the xmlcontent's content extractor not to extract certain element values?
> 
> So what I'm wondering is: can I somehow define a certain element of an xmlcontent resource type as "non-indexable"? (Something like "search.exclude", where a file/folder is excluded, but instead an xmlcontent element would be excluded.)
> 
> Best regards,
> Paul
> 
>> -----Original Message-----
>> From: opencms-dev-bounces at opencms.org 
>> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Mario Jäger
>> Sent: 27. april 2010 09:44
>> To: The OpenCms mailing list
>> Subject: Re: [opencms-dev] Configuring which xmlcontent 
>> fields to search
>>
>> Hi Paul,
>>
>> one possibility is that you map each of the elements 
>> "PageTitle", "Intro" and "Paragraph" 
>> with one property. In the WEB-INF/config/opencms-search.xml 
>> you have to add in the section 
>> <fieldconfigurations> the new fields for the index analogue 
>> to the "description" field:
>>
>> <field name="description" display="%(key.field.description)" 
>> store="true" index="true">
>>   <mapping type="property">Description</mapping>
>> </field>
>>
>> That you can add in an existing index and you can add that in 
>> a new index which only uses 
>> your specific XML contents.
>>
>> ---
>> Kind Regards,
>> Mario.
>>  
>> -------------------
>> Mario Jäger
>>  
>> Alkacon Software GmbH  - The OpenCms Experts                    
>> http://www.alkacon.com - http://www.opencms.org
>>
>>
>> Paul-Inge Flakstad schrieb:
>>> Hi everyone,
>>>  
>>> I'm wondering if there's an easy way to configure which 
>> fields of an 
>>> xmlcontent file to index?
>>>  
>>> E.g. if the XSD contains these element definitions:
>>>  
>>> <xsd:sequence>
>>>     <xsd:element name="PageTitle" type="OpenCmsString" />
>>>     <xsd:element name="Extension" type="OpenCmsExtension" 
>>> minOccurs="0" maxOccurs="1" />
>>>     <xsd:element name="Intro" type="OpenCmsHtml" minOccurs="0" 
>>> maxOccurs="1" />
>>>     <xsd:element name="Paragraph" type="OpenCmsParagraph" 
>>> minOccurs="0" maxOccurs="unbounded" />
>>> </xsd:sequence>
>>>  
>>> I don't want the "Extension" element to be searchable, but 
>> I do want 
>>> the rest of the fields searchable.
>>>  
>>> Is there a simple solution?
>>>  
>>> Cheers,
>>> Paul
>>>
>> --------------------------------------------------------------
>> ----------
>>>
>>> _______________________________________________
>>> 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
>>
> 
> _______________________________________________
> 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

-- 
Regards,
Andreas.

-------------------
Andreas Zahner

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com -  http://www.opencms.org



More information about the opencms-dev mailing list