Use facets: Solr Admin 

Advanced tutorial steps for a faceted search based on a category of data.

Distributed pivot faceting is supported. This advanced tutorial performs a faceted search using the Solr Admin query form to drill down into filter search results that are based on a category of data.

Faceting is the arrangement of search results into categories based on indexed terms. Searchers are presented with the indexed terms, along with numerical counts of how many matching documents were found were each term. Faceting makes it easy to explore search results by narrowing the search results to what you are looking for.

Procedure

The following steps drill down into the health census database that you set up in the basic tutorial. Use the Solr Admin to query the database using the age facet parameter in a query.

  1. Open the Solr Admin.
    http://localhost:8983/solr/
  2. In Core Selector, select the name of the Solr core, nhanes_ks.nhanes.
  3. Click Core Admin and then click Query.
  4. In the Solr Admin query form, specify a family size of 9 in the main query parameter text entry box--q:
    family_size:9
  5. In sort, specify sorting by age in ascending order, youngest to oldest:
    age asc
  6. In fl (filter list), specify returning only age and family size in results:
    age family_size
    Results from the main query will include only data about families of 9.
  7. Select xml from the wt drop down.
    Output will appear in XML format.
  8. Select the facet option.
    Text entry boxes for entering facet parameter values appear.
  9. In facet.field, type this value:
    age
    The number of people in each age group will appear toward the end of the query results.
  10. Click Execute Query.
    The numfound value shows that 186 families having nine members were found. The query results include only results from the fields in the filter list, age and family_size.



  11. Scroll to the end of the query form to see the facet results.
    The facet results show 11 people of age 17, 10 of age 34, and so on.



    Distributed pivot faceting is supported. You can do field, query, and range faceting with a JSON query.