Using the Solr document query join functionality

When using Solr, you will probably be used to having a flat structure of documents without any relationships. However, there are situations where decomposing relationships is a cost we can't bear. Due to this, Solr 4.0 comes with a join functionality that lets us use some basic relationships. For example, imagine that our index consists of books and workbooks, and we want to use this relationship. This recipe will show you how to do this.

How to do it...

Let's perform the following steps:

  1. First of all, let's assume that we have the following index structure (just place the following entries in your schema.xml file):
    <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" ...

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.