Using position increment to divide sentences
Imagine that we want to search in the short notes created by our users. We want to have two possibilities—searching inside a single sentence and searching inside the whole content of the note. We also know that our users don't write notes longer than 100 sentences, and each sentence has a maximum of 100 words, giving us a maximum of 10,000 words per note. To achieve this, we will use position increments that allow us to control how data is divided in the same field.
How to do it...
The following steps will allow us to fulfill our requirements:
- We start with example data, which will look like this:
<add> <doc> <field name="id">1</field> <field name="note_line">Support meeting at Monday.</field> <field name="note_line">Need ...
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.