Raza
Raza

Reputation: 139

SolrNet : How do I search a Multi-valued Field in Solr?

I am using SolrNet and my schema looks something like the following:

<int name="prodId">Id</prodid>
<str name="prodname">Name</prodname>
<arr name="categories"><str>Cat1</str><str>Cat2</str></categories
....
</doc>

Now I want to perform a search by Category. That is retrieve product whose category collection has "Cat1" for example. Please let me know how I can do this using SolrNet. Thanks!

Upvotes: 0

Views: 1078

Answers (1)

Paige Cook
Paige Cook

Reputation: 22555

You do not need to do anything special for searching a multivalued field. The following should work just fine:

var query = new SolrQueryByField("categories","Cat1");

or

var query = new SolrQuery("categories:Cat1");

Upvotes: 2

Related Questions