nish
nish

Reputation: 7280

solr : how to search for a tag in a specific field

I want to perform a search for occurrence of specific tags in a field:

<field name="productTagValues" type="text_en" indexed="true" stored="true" multiValued="true" />

A document can have multiple tags. Eg.:

"productTagValues": [
      "Everyday Wear",
      "Double Chain",
      "Traditional and Imitation",
      "Gold Plating",
      "Metal Alloy",
      "Special Occasions or Gifts"
}

I want to retrieve all the docs that have a specific tag. Eg. all the docs with Gold Plating as one of the tags.

I tried using fq=productTagValues:Gold Plating. But it also returned docs that didn't have Gold Plating in the productTagValues field.

Could someone please help me with this

Upvotes: 0

Views: 255

Answers (1)

Bartlomiej Lewandowski
Bartlomiej Lewandowski

Reputation: 11190

As I said in the comment, the solution was to do a query:

q=productTagValues:Gold Plating

instead of

fq=productTagValues:Gold Plating

Upvotes: 1

Related Questions