cancel
Showing results for 
Search instead for 
Did you mean: 

Parameter 'model' is null! solr index

0 Kudos
288

Hi! I have a problem in hybris facet. I want to new facet in search page.But, System creating a 'product is null' error when I indexing.Can you help me?

*/ @SuppressWarnings("deprecation") public class LenghtValueProvider extends ClassificationPropertyValueProvider { private FieldNameProvider fieldNameProvider; private UnitService unitService;

 @Override
 public Collection<FieldValue> getFieldValues(final IndexConfig indexConfig, final IndexedProperty indexedProperty,
         final Object model) throws FieldValueProviderException
 {
     if (model instanceof ProductModel)
     {
         final ClassAttributeAssignmentModel classAttributeAssignmentModel = indexedProperty.getClassAttributeAssignment();
         final ClassAttributeAssignment classAttributeAssignment = modelService.getSource(classAttributeAssignmentModel);

         final Product product = (Product) modelService.getSource(model);
         final FeatureContainer cont = FeatureContainer.loadTyped(product, classAttributeAssignment);
         if (cont.hasFeature(classAttributeAssignment))
         {
             final TypedFeature<Object> feature = cont.getFeature(classAttributeAssignment);
             if (feature == null || feature.isEmpty())
             {

                 System.out.println("****1111111111111111111111111111111111111111********************************");
                 return Collections.emptyList();

             }
             else
             {
                 System.out.println("****222222222222222222222222222222222222222222222**********************************");
                 return getFeaturesValues(indexConfig, feature, indexedProperty);
             }
         }
         else
         {

             System.out.println(
                     "****333333333333333333333333333333333333333333333333333333333******************************************3");
             return Collections.emptyList();
         }
     }
     else
     {
         throw new FieldValueProviderException("Cannot provide classification property of non-product item");
     }
 }



 public UnitService getUnitService()
 {
     System.out.println("****4444444444444444444444444444444444444444444**********************************");
     return unitService;
 }

 @Required
 public void setUnitService(final UnitService unitService)
 {
     System.out.println("****555555555555555555555555555555555555555555555555**********************************");
     this.unitService = unitService;
 }

 @Override
 public FieldNameProvider getFieldNameProvider()
 {
     System.out.println("****666666666666666666666666666666666666666666666666666**********************************");
     return fieldNameProvider;
 }

 @Override
 @Required
 public void setFieldNameProvider(final FieldNameProvider fieldNameProvider)
 {
     System.out.println("****777777777777777777777777777777777777777777777777777777**********************************");
     this.fieldNameProvider = fieldNameProvider;
 }



}

0 Kudos

Hey,

have you find any solution ? my issue is similar as yours.. Please let me know if you got any fix.

Thanks

Accepted Solutions (0)

Answers (0)