Tags Related to a Search
At an installation with a tag structure called
Topics
, the following query will return:
-
Information about the first 20 content items containing the word "christmas" in the
title
field -
A list of the
Topics
tags attached to all content items containing the word "christmas" (not just the first 20), and how many content items are tagged with each tag.
http://your-host/solr/select?q=christmas&wt=xml&rows=20&facet=true&facet.field=topics_facet
The tags related to a search can be used to:
-
Provide links in the search result that allow the user to narrow the search results. A user who is interested in the history of Christmas, for example might click on a "History" link to see a list of items that both match the search and are tagged with the keyword "History".
-
Generate a tag cloud for the search. The faceting results include the number of content items tagged with each tag, which can be used to determine the relative sizes of the links in the cloud.
The index fields generated for tag structures always have lower
case names. So even though the tag structure is called
Topics
, the corresponding index field is called
topics_facet
. The above query will not work if
the field name Topics_facet
is used.