2

Im new to Lucene. Is there a way to get the Lucene FVH to return fragments/snippets centered around the search query instead of approximately starting with the search query? Also, Is there a way to tell the FVH fragmenter to fragment only at the newline char? Thanks!

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
Nacha
  • 107
  • 1
  • 5

2 Answers2

2

Sujit Pal has a description of how to create your own fragments builder on his Salmon Run blog: http://sujitpal.blogspot.com/2011/05/customizing-lucenes-fast-vector.html

Also, Grant Ingersoll has a post at the Lucid blog about using a TermVectorMapper to construct a window around the terms so that you can pull N preceding and subsequent terms: http://www.lucidimagination.com/blog/2009/05/26/accessing-words-around-a-positional-match-in-lucene/

0

There isn't a pure lucene way to do this, apart from making your own frag builder AFAIK. However, you can provide Solr with a regex indicating how you want fragments to look. See the docs.

Xodarap
  • 11,581
  • 11
  • 56
  • 94