0

我想用 Solr.net Schema 文件添加产品。我的数据库表是

Category table - catid, catname
Brand table - brandid, brandname
Item table - productid, productname, productdesc
Filter table- key, value

注意:- 如果我用表格添加所有内容,则会发生数据重复。所以如果你有更好的解决方案,那么请给我一个例子。

提前致谢。阿舒托什 9818842034

4

2 回答 2

4

要在 Solr/SolrNet 中表示一个 multiValued 字段,首先您必须在 Solr schema 中将该字段声明为 multiValued。然后将该字段映射为集合类型的属性

您提到“数据重复”。这在 Solr 中是预期的,因为您必须对数据进行非规范化。请参阅Solr 模式设计 wiki 以供参考

于 2011-04-05T14:10:22.633 回答
1

To index products in Solr the fields in your schema.xml should be something like this:

<fields>
  <field name="id" type="string" indexed="true" stored="true" required="true" />
  <field name="name" type="text" indexed="true" stored="true"/>
  <field name="desc" type="text" indexed="true" stored="true"/>
  <field name="catname" type="string" indexed="true" stored="true" multiValued="true"/>
  <field name="brandname" type="string" indexed="true" stored="true"/>
</fields>

Notice multiValued="true" is set for the category name, so products can have more than one category. I don't think you need to send to Solr category Ids or brand Ids, but that depends on your application.

于 2011-06-15T02:00:17.023 回答