c# - Getting spans for a SpanNear query? -


i trying words surrounding match in spannearquery not able figure out how to. know there function called getspans documented here:

  129         public override spans getspans(indexreader reader)   130         {   131             if (clauses.count == 0)   132             // optimize 0-clause case   133                 return new spanorquery(getclauses()).getspans(reader);   134                135             if (clauses.count == 1)   136             // optimize 1-clause case   137                 return clauses[0].getspans(reader);   138                139             return inorder?(spans) new nearspansordered(this, reader, collectpayloads):(spans) new nearspansunordered(this, reader);   140         } 

is function supposed use (because return list/array of spans single span) or there other function?

for instance, if text is: lucene powerful , search term lucene powerful, want retrieve words in match.

in order able access adjacent words, need store termvectors position , offset information @ indexing time, can use retrieve surrounding words.

see http://searchhub.org/2009/05/26/accessing-words-around-a-positional-match-in-lucene/ detailed explanation.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -