You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sujit Pal <su...@comcast.net> on 2011/05/23 20:28:24 UTC

FastVectorHighlighter - can FieldFragList expose fragInfo?

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


Re: FastVectorHighlighter - can FieldFragList expose fragInfo?

Posted by Sujit Pal <su...@comcast.net>.
Thank you Koji. I opened LUCENE-3141 for this.
https://issues.apache.org/jira/browse/LUCENE-3141 

-sujit

On Tue, 2011-05-24 at 22:33 +0900, Koji Sekiguchi wrote:
> (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


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


Re: FastVectorHighlighter - can FieldFragList expose fragInfo?

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
(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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org