(11/05/24 3:28), Sujit Pal wrote: > 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?
No. Please open a jira ticket and attach a patch, if possible. I'll take a look. koji -- http://www.rondhuit.com/en/ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org