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.
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 to prepare presentation.</field> </doc> </add>
Now, we need to create an index structure. To do this, we need to add the fields that will be used. We do this by adding...