How to Add multivalue Data in Solr.Net
I want to Add product with Solr.net Schema file. my database Table is
Category table - catid, catname
Brand table - brandid, brandname
Item table - productid, productname, productdesc
Filter table- ke开发者_如何学Pythony, value
Note:- if i add all with a Table then data Repeatation occur. so if u have better solution then please suggest me with an examle.
Thanks in Advance. Ashutosh 9818842034
To represent a multiValued field in Solr/SolrNet, first you have to declare the field as multiValued in the Solr schema. Then map the field as a property of collection type.
You mention "data repetition". That is expected in Solr, as you have to denormalize your data. See the Solr schema design wiki for reference.
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.
精彩评论