Reputation: 10138
I want use Search API but not know how to add multiple tags - it is not describe clearly.
Can I do such thing:
fields = []
for tag in self.tags:
fields.append(search.TextField(name = 'tag', value = tag))
Or it need different approach since multiple 'tag' fields is not possible?
Upvotes: 0
Views: 216
Reputation: 1822
You can whitespace concatenate all the tags into one text field.
If you're only interested in matching documents and don't require the tags to be structured as separate field, a query matching any tag will return the document as a match. This also helps when searching on multiple tags, because the document can have a higher relevance if it has both.
Upvotes: 1
Reputation: 599876
It is not true that "multiple tag fields is not possible". You can have multiple fields with the same name.
Upvotes: 3