Using simple nested queries

Imagine a situation where you need a query nested inside another query. For example, you want to run a query using the standard request handler, but you need to embed a query that is parsed by the dismax query parser inside it. For example, we will like to find all the books having a certain phrase in their title, and boost the ones that have a part of the phrase present. This recipe will show you how to do this.

How to do it...

Let's start with a simple index that has the following structure:

  1. You need to put the following section to the schema.xml file:
    <field name="id" type="string" indexed="true" stored="true" required="true" />
    <field name="title" type="text_general" indexed="true" stored="true" />
  2. The next step is data ...

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.