Hello,

My version: Lucene 3.1.0

I've had to customize the snippet for highlighting based on our
application requirements. Specifically, instead of the snippet being a
set of relevant fragments in the text, I need it to be the first
sentence where a match occurs, with a fixed size from the beginning of
the sentence.

For this, I built (in my application code, using Lucene jars) a custom
FragmentsBuilder (subclassing SimpleFragmentBuilder and overriding the
createFragment(IndexReader reader, int docId, String fieldName,
FieldFragList fieldFragList). 

However, the FieldFragList does not allow access to the
List<WeightedFragInfo> member variable. I changed this locally to be
public so my subclass can access it, ie:

public List<WeightedFragInfo> fragInfos = new
ArrayList<WeightedFragInfo>();

Once this is done, my createFragment method can get at the fragInfos
from the passed in fieldFragList, iterate through its
WeightedFragInfo.SubInfo.Toffs to get the term offsets, which I then use
to calculate and highlight my snippet (I can provide the code if it
makes things clearer, but thats the gist).

So my question is - would it be feasible to make the
FieldFragList.fragInfos variable public in a future release?

If not, is there some other way that I should do what I need to do?

Thanks very much,
Sujit



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to