Another solution is to use hierachical values. So for example, instead
of having a "Barack Obama" value you'll have "person/Barak Obama". To
filter on a person you can just use wildcards (e.g. "person/*").
Asif Rahman wrote:
Is there any way to assign metadata to terms in a field and then filter on
that metadata when using that field as a facet?
For example, I have a collection of news articles in my index. Each article
has a field that contains tags based on the topics discussed in the
article. An article might have the tags "Barack Obama" and "Chicago". I
want to assign metadata describing what type of entity each tag is. For
these tags the metadata would be "person" for "Barack Obama" and "place" for
"Chicago". Then I want to issue a facet query that returns only "person"
facets.
I can think of two possible solutions for this, both with shortcomings.
1) I could create a field for each metadata category. So the schema would
have the fields "tag_person" and "tag_place". The problem with this method
is that I am limited to filtering by a single criterion for each of my
queries.
2) I could leave the Solr schema unmodified and post-process the query.
This solution is less elegant than one that could be completely contained
within Solr. I also imagine that it would be less performant.
Any thoughts?
Thanks in advance,
Asif