[opencms-dev] Lucene date range search in individual xmlContent date fields

"Rüdiger Kurz (list)" r.kurz at alkacon.com
Wed May 23 15:15:31 CEST 2012


Amusing an XML content schema as follows:

     <xsd:element name="Date" type="OpenCmsDateTime" minOccurs="0" />
     <searchsetting element="Date" searchcontent="true"/>
Then the extraction result (CmsExtractionResult) should contain the 
element="Date" from the example above in the Map of extracted items 
using the xPath as key and the extracted date as String value.

If we look at the code where the content is extracted we see something like:

String extracted = value.getPlainText(cms);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(extracted)) {
     items.put(xpath, extracted);
} [...]
return new CmsExtractionResult(content, items);

If the return value of value.getPlainText(cms) is null the element's 
value is neither stored as plain text content nor as item. So if one 
would like to prevent that the element is part of the plain text content 
itself we must return null in value.getPlainText(cms).

Currently it is not provided to distinguish between XML content elements 
that should be stored as item and/or as part of the full text search 


On 05/23/2012 10:27 AM, "Rüdiger Kurz (list)" wrote:
> Hi,
>  > <searchsettings>
>  > <searchsetting element="Date" searchcontent="true"/>
>  > </searchsettings>
> There is a field in the lucene index that contains a collection of all
> "plain text" extraction of a resource. The searchsetting tells OpenCms
> to add the referenced element to this "content" field. If you do this
> for an date you will have an extraction String that contains the long
> value of that date. The <searchsetting> is not meant to be a field
> configuration. It's more like an easy way to add/prevent XML elements to
> be searched by the full text search.
> To solve your problem, please see the other thread.
> Kindly regards
> Rüdiger
> On 05/23/2012 10:10 AM, ] Code Create [ Bernd Wolfsegger wrote:
>> Hi Rüdiger,
>> yeah, but as I said, even setting searchsettings makes no difference:
>> <xsd:annotation>
>> <xsd:appinfo>
>> <resourcebundle name="xxxxxxxxxx"/>
>> <preview uri="${previewtempfile}"/>
>> <searchsettings>
>> <searchsetting element="Date" searchcontent="true"/>
>> </searchsettings>
>> </xsd:appinfo>
>> </xsd:annotation>
>> Anything wrong with the syntax ?
>> Anyway, the xsd says default is "true" so I shouldn't have to set this.
>> Kind regards, Bernd
>>> -----Ursprüngliche Nachricht-----
>>> Von: "Rüdiger Kurz (list)" [mailto:r.kurz at alkacon.com]
>>> Gesendet: Mittwoch, 23. Mai 2012 09:31
>>> An: ocms at code-create.de; The OpenCms mailing list
>>> Betreff: Re: [opencms-dev] Lucene date range search in individual
>>> xmlContent date fields
>>> Hi,
>>> On 05/23/2012 12:22 AM, ] Code Create [ Bernd Wolfsegger wrote:
>>>> Hi Rüdiger,
>>>> I think that's why:
>>>> public class CmsXmlDateTimeValue extends A_CmsXmlValueTextBase {
>>>> public boolean isSearchable() {
>>>> // there is no point in searching date/time values
>>>> // they are stored as long int anyway
>>>> return false;
>>>> }
>>> This is just the default. The concrete search settings are done in the
>>> appinfo of the XML Content schema:<xsd:searchsettings>
>>>> But even changing this and compiling etc. as well as setting explicit
>>> search
>>>> annotation in the xsd, doesn't change the behavior.
>>>> The field value is not to be found in the extractionResult.
>>>> Kind regards, Bernd
>>> - Rüdiger

More information about the opencms-dev mailing list