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:
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" />
The next step is data indexing. Our example data looks as follows:
<add> <doc> <field name="id">1</field> <field name="title">Revised solrcookbook</field> </doc> <doc> <field name="id">2</field...