cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Use MessageSource in Provider Solr

Former Member
0 Likes
496

Hi, community. I want a facet boolean in my search page and I need True/False label to have an attribute localized in a base_.properties* files, if it's possible from a storefront module.

I have this in hymodulecore:

 public class SellableFacetDisplayNameProvider extends AbstractFacetValueDisplayNameProvider {
 
     private static final String SELLABLE = "facet.sellable";
     private static final String NOT_SELLABLE = "facet.notsellable";
 
     private MessageSource messageSource;
     private I18NService i18NService;
 
     @Override
     public String getDisplayName(final SearchQuery query, final IndexedProperty property, final String facetValue) {
         if (StringUtils.equals(String.valueOf(Boolean.TRUE), facetValue)) {
             return messageSource.getMessage(SELLABLE, null, i18NService.getCurrentLocale());
         }
 
         if (StringUtils.equals(String.valueOf(Boolean.FALSE), facetValue)) {
             return messageSource.getMessage(NOT_SELLABLE, null, i18NService.getCurrentLocale());
         }
 
         return facetValue;
     }
 

And the Spring declaration:

 <bean id="sellableFacetValueDisplayNameProvider"
           class="sr.hybris.core.service.search.solrfacetsearch.provider.impl.SellableFacetDisplayNameProvider" >
         <property name="i18NService" ref="defaultI18NService"/>
         <property name="messageSource" ref="messageSource"/>
     </bean>

When loading Messagesource the error is that it does not find the specific property, not even in the hymodulecore.

I know this MessageSource doesn't similar to StorefrontMessageSource, but I can't load this last. Can I do this? Am I on the right?

Thanks!

Regards, Ismael

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

I would recommend to better use the "languageQulaifierProvider" to support different languages in indexing. please refer to https://help.hybris.com/6.6.0/hcd/8c7dea5386691014aceaa6b5ab3e31b9.html

Former Member
0 Likes

I am sorry, but this resource has not helped me to collect the necessary properties or I have not understood it correctly.

Thank you so much for the advice.