如何在solr中对动态场进行分面

  • 本文关键字:动态 solr solr
  • 更新时间 :
  • 英文 :


我们使用的是solr 7.5,我们已经为products属性实现了动态字段,现在我们面临着在动态字段上做facet的问题。

following are the product documents for the dynamic field
<dynamicField name="*_attribute" type="text_general" multiValued="true" indexed="true" stored="true"/>
{
"product_slno":"1",
"product_name":["baby doll"],
"text":["baby doll"],
"color_attribute":["red1"],
"type_attribute":["xyz1"],
"material_attribute":["plastic1"],
"_version_":1660058653347020800},
{
"product_slno":"2",
"product_name":["babydoll"],
"text":["babydoll"],
"color_attribute":["red"],
"style_attribute":["xyz"],
"material_attribute":["plastic"],
"_version_":1660058653383720960
},
for example if we want to get the color_attribute value for entire document the we are not able to geet it.
and we do not have the fixed attribute for any products so we are trying to use dynamic fields
please help

您需要更改faceting字段的字段类型。如果您使用字符串作为faceting字段的字段类型,那就太好了。标记化不利于面子。因为您正在为您的字段使用text_general。你也需要改变。

由于字符串类型将没有文本的tokenization,并用作faceting的单个令牌。

您可以有一个单独的字段,如下所示用于贴面。

<dynamicField name="*_facet_attribute" type="string" multiValued="true" indexed="true" stored="true"/>

您可以将其作为动态字段或普通字段。

最新更新