Lucene.Net.Search.PhraseQuery.GetPositions C# (CSharp) Method

GetPositions() public method

Returns the relative positions of terms in this phrase.
public GetPositions ( ) : int[]
return int[]
		public virtual int[] GetPositions()
		{
			int[] result = new int[positions.Count];
			for (int i = 0; i < positions.Count; i++)
				result[i] = positions[i];
			return result;
		}
		

Usage Example

 private SectionSearchQueryPlan TranslatePhraseQuery(PhraseQuery query)
 {
     Term[] terms = query.GetTerms();
     TermNode[] nodes = new TermNode[terms.Length];
     int[] positions = query.GetPositions();
     for (int i = 0; i < terms.Length; i++)
     {
         nodes[i] = new TermNode(terms[i], positions[i], _reader);
     }
     return new PhraseNode(nodes, _reader);
 }