我创建了一个新的多值facet,下面是配置:
Solr.impex
:
INSERT_UPDATE SolrIndexedProperty;solrIndexedType(identifier)[unique=true];name[unique=true];type(code);sortableType(code);currency[default=false];localized[default=false];multiValue[default=false];facet[default=true];facetType(code);facetSort(code);priority;visible;useForSpellchecking[default=false];useForAutocomplete[default=false];fieldValueProvider;facetDisplayNameProvider;customFacetSortProvider;topValuesProvider;rangeSets(name)
;$solrIndexedType; area; string ; ;true ; ;true ; ;MultiSelectOr ;Custom;10000;true; ; ;productAreaResolver;dfgProductFacetDisplayNameResolver;
解析器:
public class ProductAvailabilityResolver extends AbstractValueResolver<ProductModel, Object, Object>
{
/*
* (non-Javadoc)
*
* @see de.hybris.platform.solrfacetsearch.provider.impl.AbstractValueResolver#addFieldValues(de.hybris.platform.
* solrfacetsearch.indexer.spi.InputDocument, de.hybris.platform.solrfacetsearch.indexer.IndexerBatchContext,
* de.hybris.platform.solrfacetsearch.config.IndexedProperty, de.hybris.platform.core.model.ItemModel,
* de.hybris.platform.solrfacetsearch.provider.impl.AbstractValueResolver.ValueResolverContext)
*/
@Override
protected void addFieldValues(final InputDocument document, final IndexerBatchContext indexerBatchContext,
final IndexedProperty indexedProperty, final ProductModel product,
final ValueResolverContext<Object, Object> resolverContext) throws FieldValueProviderException
{
document.addField(indexedProperty, product.getAvailability(), resolverContext.getFieldQualifier());
}
}
spring xml中的Bean Entry:
<bean id="productAreaResolver" class="de.hybris.training.search.solrfacetsearch.provider.impl.ProductAreaResolver" parent="abstractValueResolver">
</bean>
但是毕竟这个方面还没有显示出来,我调试了这个问题并发现resolverContext.getFieldQualifier()
无效,但不确定这是否是问题的原因。