Ashish
Ashish

Reputation:

Lucene .Net Searching with TermVector

in Lucene.Net,i am creating the document for searching a word and want to display before 10 words and after 10 words.i have used TermVector.

Lucene.Net.Documents.Field fldContent =
    new Lucene.Net.Documents.Field("content", content,
        Lucene.Net.Documents.Field.Store.YES,
        Lucene.Net.Documents.Field.Index.TOKENIZED,
        Lucene.Net.Documents.Field.TermVector.WITH_POSITIONS_OFFSETS);

Can anyone help me how to find out the keyword position and extract nearest 15 words. please send some code.

Thanks

Ashish

Upvotes: 0

Views: 2446

Answers (2)

Mikos
Mikos

Reputation: 8543

You should be looking at Lucene highlighter, it extracts a snippet of text surrounding the query term. This link gives an example.

Upvotes: 1

Hitesh
Hitesh

Reputation: 86

Ashish, Check out the following link.

http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/

Hitesh.

Upvotes: 1

Related Questions