OpenCms - configuring Solr search to extract nested fields

There is a Foo schema with one nested field

 <?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
   <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd" />
   <xsd:include schemaLocation="opencms://system/modules/com.foo.bar/schemas/barList.xsd" />
   <xsd:element name="Foos" type="OpenCmsFoos" />
   <xsd:complexType name="OpenCmsFoos">
      <xsd:sequence>
         <xsd:element name="Foo" type="OpenCmsFoo" minOccurs="0" maxOccurs="unbounded" />
      </xsd:sequence>
   </xsd:complexType>
   <xsd:complexType name="OpenCmsFoo">
      <xsd:sequence>
         <xsd:element type="OpenCmsBarList" name="bars"  minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="language" type="OpenCmsLocale" use="required" />
   </xsd:complexType>
   <xsd:annotation>
      <xsd:appinfo>
         <validationrules />
         <relations />
         <searchsettings containerPageOnly="false">
            <searchsetting element="bars" searchcontent="true">
               <solrfield targetfield="bars" sourcefield="*_s" />
            </searchsetting>
         </searchsettings>
      </xsd:appinfo>
   </xsd:annotation>
</xsd:schema>

      

BarList schema is defined as

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
   <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd" />
   <xsd:element name="BarLists" type="OpenCmsBarLists" />
   <xsd:complexType name="OpenCmsBarLists">
      <xsd:sequence>
         <xsd:element name="BarList" type="OpenCmsBarList" minOccurs="0" maxOccurs="unbounded" />
      </xsd:sequence>
   </xsd:complexType>
   <xsd:complexType name="OpenCmsBarList">
      <xsd:sequence>
         <xsd:element name="barName" type="OpenCmsString" />
         <xsd:element name="barCategory" type="OpenCmsString"/>
         <xsd:element name="barDescription" type="OpenCmsString"/>
      </xsd:sequence>
      <xsd:attribute name="language" type="OpenCmsLocale" use="optional" />
   </xsd:complexType>
   <xsd:annotation>
      <xsd:appinfo>
         <validationrules />
         <relations />
         <searchsettings containerPageOnly="false">
            <searchsetting element="barList" searchcontent="true">
               <solrfield targetfield="barList" sourcefield="*_s" />
            </searchsetting>
         </searchsettings>
      </xsd:appinfo>
   </xsd:annotation>
</xsd:schema>

      

and when i make a request with an id for resource Foo like

http://<ip>/opencms/handleSolrSelect?fl=*_en_s&fq=id:(<id>)&omitHeader=true

      

BarList is not returned. If I add a textbox of type OpenCmsString / OpenCmsHtml it will be returned. I am using opencms for the first time. Any help is appreciated. Thanks in advance.

0


source to share





All Articles