FAQ

Q.What is positionIncrementGap?

A.

In Apache Solr's managed-schema.xml, positionIncrementGap is used to set the gap value between each value in a multiValued="true" field.

For example, let's say we have the following schema settings.

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
  <analyzer>
    <tokenizer name="standard"/>
    <filter name="lowercase"/>
  </analyzer>
</fieldType>

<field name="body" type="text" indexed="true" stored="true" multiValued="true"/>

By doing this, the body field, which is set as multiValued="true", can accept data like the following:

{
  "body": [
    "I am a boy",
    "Girl likes a boy"
  ]
}

In this case, due to the setting positionIncrementGap="100" between the first value "I am a boy" and the second value "Girl likes a boy" in the body field, there is a gap of 100 tokens interpreted. As a result, this document will not be hit in the following phrase search.

q=body:"boy girl"

However, without specifying positionIncrementGap="100", the two sentences in the above JSON are considered continuous, and as a result, they will be hit by the phrase query above. Typically, we don't want to perform phrase searches between consecutive elements within an array of a field specified as multiValued="true", so it is common to set positionIncrementGap="100" or similar.

For estimates and details,
please feel free to contact our development team.

Contact Us
TOP