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

How to Get productData inside solr value provider ?

Former Member
0 Likes
353

Here my requirement getting ProductData insted of Product model. Exaple: public Collection getFieldValues(final IndexConfig indexConfig, final IndexedProperty indexedProperty, final Object model) throws FieldValueProviderException { if (model instanceof ProductData) { final ProductData product = (ProductData) model;

But this Code is not working , cal you please suggest how to get ProductData inside the Solr value provider. ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Huskar
Participant
0 Likes

No its not possible. Why are you even casting model to data. Value provider works with model and not data. If you need data then convert model to data in your provider and do whatever you want.

Former Member
0 Likes

Hello Krishna thanks for your answer.

I tried this way but its not working , please validate the code.

public Collection getFieldValues(final IndexConfig indexConfig, final IndexedProperty indexedProperty, final Object model) throws FieldValueProviderException { if (model instanceof ProductData) { final ProductData product = (ProductData) model;

Please suggest me how to get Product data in solr attribute value provider ?

former_member704915
Participant
0 Likes

I have provided you the answer in the first response. Did you try that?

former_member704915
Participant
0 Likes

I would suggest that you can use the product converter.

 private Converter<ProductModel, ProductData> productConverter;



 final ProductModel product = (ProductModel) model;
 final ProductData productData = getProductConverter().convert(product .getProduct());





Former Member
0 Likes

HEllo Gupta, Itried this way but it's not working code: final ProductModel product = (ProductModel) model; final ProductData productData = getProductConverter().convert(product);

can you pleaase guid me yar.

Thanks, selva.

former_member704915
Participant
0 Likes

What is the error you are facing? Share the error log here.