Removing filters from faceting results

Let's assume for the purpose of this recipe, you have an application that can search for companies within a city and a state. However, the requirements say that not only should you show the search results, but also the number of companies in each city and the number of companies in each state (to say in the Solr way—you want to exclude the filter query from the faceting results). Can Solr do this efficiently ? Sure it can, and this recipe will show you how to do it.

Getting ready

Before you start reading this recipe, let's take a look at the Getting the number of documents with the same field value recipe of this chapter.

How to do it...

  1. As usual we start with a very simple index structure that contains four ...

Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.