Book Image

Solr Cookbook - Third Edition

By : Rafal Kuc
Book Image

Solr Cookbook - Third Edition

By: Rafal Kuc

Overview of this book

Table of Contents (18 chapters)
Solr Cookbook Third Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Calculating faceting for relevant documents in groups


If you have ever used the field-collapsing functionality of Solr, you might be wondering whether there is a possibility of using that functionality and faceting. Of course, there is, but the default behavior still works and so you get the faceting calculation on the basis of documents and not on document groups. In this recipe, we will learn how to query Solr so that it returns facets calculated for the most relevant document in each group.

Getting ready

Before reading the following recipe, let's take a look at Grouping documents by the field value, Grouping documents by the query value, and Grouping documents by the function value recipes in Chapter 8, Using Additional Functionalities. Also if you are not familiar with faceting functionality, read the first three recipes of this chapter.

How to do it...

  1. In the first step, we need to create an index. For the purpose of this recipe, let's assume that we have the following index structure ...