SAP Knowledge Base Article - Preview

2023359 - How to create and configure SolrFacetSearch Value Providers

Symptom

Motivation

In the simplest scenario, it is only necessary to configure the name and type attributes for the indexed property. In this case, for each object that is returned by the indexer query, the used value will come from the attribute in the ordinary Java object (plain old Java object, or POJO) with the same name as the one configured in the indexed property.

Many times this is not enough and you may want to:

  • process the value in some way that it may change;
  • get the value from a different place, other than the POJO.

When the default behavior is not enough, the solution is to use a value provider. In this trail we will explain in more detail how this process works and how you can create your own value providers.

Default Behavior

By default, even if not explicitly configured, the modelPropertyFieldValueProvider will be used. In this case, the used value will come from the attribute in the POJO with the same name as the one configured in the indexed property.

There are some import details that are worth mentioning:

  • This value provider checks if the indexed property is localized and acts accordingly;
  • If the POJO is of type VariantProductModel and the result is null, it will return the attribute value from the base product.


Read more...

Environment

CPS-SER versions 4.x and 5.x.

Product

SAP hybris Commerce Suite 5.2 ; SAP hybris Commerce Suite 5.3 ; hybris Commerce Suite 4.4 ; hybris Commerce Suite 4.5 ; hybris Commerce Suite 4.6 ; hybris Commerce Suite 4.7 ; hybris Commerce Suite 4.8 ; hybris Commerce Suite 5.0 ; hybris Commerce Suite 5.1

Keywords

Solr, SolrFacetSearch value provider , KBA , CEC-COM-CPS-SER , Search , How To

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.