[opencms-dev] Mapping OpenCMS structured content XML field to a SOLR field
Rüdiger Kurz
r.kurz at alkacon.com
Mon Feb 11 19:44:35 CET 2013
Hi,
please paste the following URL into a browser window (you need to be
logged into OpenCms with the browser for having access to OpenCms
Offline Solr Index):
http://localhost:8080/opencms/opencms/handleSolrSelect?fq=con_locales:*&fq=parent-folders:*&fq=path:/the/full/path/to/the/resource/you/expect&fl=*,score
and send the XML result to the mailing list.
regards
Rüdiger
Am 11.02.2013 19:32, schrieb Ramon Gavira:
> Hi Arturo.
>
> We have the same problema, did get it work??
>
> -----Mensaje original-----
> De: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org]
> En nombre de Arturo Martín Lladó
> Enviado el: miércoles, 23 de enero de 2013 12:54
> Para: opencms-dev at opencms.org
> Asunto: [opencms-dev] Mapping OpenCMS structured content XML field to a SOLR
> field
>
> Hi,
>
> We are trying to map an OpenCMS structured content XML field to a SOLR field
> in order to perform a search using that field as a filter.
>
> The XML field is described this way in the XSD file:
>
> <xsd:complexType name="OpenCmsContrato">
> <xsd:sequence>
> [...]
> <xsd:element name="numeroExpediente" type="OpenCmsString"
> minOccurs="1" maxOccurs="1" />
> [...]
> </xsd:sequence>
> <xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
> </xsd:complexType>
>
> And these are the search settings for the element, defined in the same XSD
> file:
>
> <xsd:annotation>
> <xsd:appinfo>
> [...]
> <searchsettings>
> <searchsetting element="numeroExpediente" searchcontent="true">
> <solrfield targetfield="numexp" />
> </searchsetting>
> </searchsettings>
> [...]
> </xsd:appinfo>
> </xsd:annotation>
>
> The target SOLR field "numexp" is defined this way in SOLR's schema.xml
> file:
>
> <fields>
> <field name="numexp" type="string"
> indexed="true" stored="true" />
> [...]
> </fields>
>
> And this is the way we perform the query to SOLR on a JSP file:
>
> CmsSearchManager manager = OpenCms.getSearchManager(); CmsSolrIndex index =
> manager.getIndexSolr("Solr Online");
>
> String query = "fq=type:contrato";
>
> if (!"".equals(text))
> query += "&fq=numexp:" + text;
>
> CmsSolrResultList listFiles = index.search(cmso, query);
>
> When we execute this code, we get listFiles.size() = 0, but when we change
> the filter field to the predifined SOLR field "content", this
> way:
>
> if (!"".equals(text))
> query += "&fq=content:" + text;
>
> we get the expected result.
>
> With the CmsSearchResource object we get using the "content" SOLR field as
> filter, we are able to iterate over the fields of its inner
> I_CmsSearchDocument, getting this list as result:
>
> id
> contentblob
> path
> type
> suffix
> created
> lastmodified
> contentdate
> relased
> expired
> res_locales
> con_locales
> template_prop
> default-file_prop
> notification-interval_prop
> NavPos_prop
> enable-notification_prop
> locale_prop
> NavText_prop
> Title_prop
> category
> ca_excerpt
> timestamp
> score
> link
>
> No presence of the "numexp" field on the list. Why? Are we missing any step?
> Do we have to configure something else in order to make the mapping work?
>
> Thank you in advance.
>
> Regards,
>
> Arturo.
> _______________________________________________
--
Kind Regards,
Rüdiger.
-------------------
Rüdiger Kurz
Alkacon Software GmbH - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org
More information about the opencms-dev
mailing list