
Lucene 4 Cookbook
By :

The PositionIncrementAttribute
class shows the position of the current token relative to the previous token. The default value is 1. Any value greater than 1 implies that the previous token and the current token are not consecutive – there is a gap between the two tokens where some tokens (for example, stopwords) are omitted. This attribute is useful in phrase matching, where the position and order of words matters. For example, say you want to execute an exact phrase match. As we step through TokenStream, the PositionIncrementAttribute
class on each matching token should be 1 so we know the phrase we are matching is matched word for word exactly in the same order as the search phrase.
Another use of this attribute is synonym matching in a phrase query. Synonyms can be inserted into the TokenStream following the term that's being expanded. The position increments for the synonyms would set to 0 as that indicates the synonym term is at the same...
Change the font size
Change margin width
Change background colour