lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sujit Pal <sujit....@comcast.net>
Subject FastVectorHighlighter - can FieldFragList expose fragInfo?
Date Mon, 23 May 2011 18:28:24 GMT
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message