I want to be able to use the itemtype you can use in backoffice (image attach) in the rest api like this "https://localhost:9002/rest/v2/test/products/search?fields=FULL&query=:name-asc:itemType:Concrete:category:PHX";
is that possible?
im using hybris 6.4
It is possible. You have to create indexed property for your SOLR configuration which indexes item type.
For that create impex:
INSERT_UPDATE SolrIndexedProperty; $solrIndexedType; name[unique = true] ; backofficeDisplayName; type(code); facet[default=true]; multiValue; priority; fieldValueProvider ; valueProviderParameter ; facetDisplayNameProvider ; facetType(code); facetSort(code); visible[default=true]
; ; productType ; Product Type ; string ; ; false ; 1 ; productTypeValueResolver ; ; ; MultiSelectOr ; Alpha
And then create your resolver
public class ProductTypeValueResolver extends AbstractValueResolver<ItemModel, Object, Object> {
@Override
protected void addFieldValues(final InputDocument inputDocument, final IndexerBatchContext indexerBatchContext,
final IndexedProperty indexedProperty, final ItemModel product,
final ValueResolverContext<Object, Object> resolverContext) throws FieldValueProviderException {
inputDocument.addField(indexedProperty, product.getItemtype(), resolverContext.getFieldQualifier());
}
}
and finally create a spring bean with that resolver
<bean id="productTypeValueResolver" class="com.your.package.ProductTypeValueResolver" parent="abstractValueResolver">
After that you will get extra property in solr which will reflect your item type and you can use it on product search endpoint