lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <markharw...@yahoo.co.uk>
Subject Re: highlight only one field
Date Fri, 11 Nov 2005 18:04:25 GMT
>>> This don't work, because

Ah, crap. You'll have to drop down another level.
Every line of code in QueryTermsExtractor that calls 
    terms.add(new WeightedTerm(..))
would be the place to test the field name then.
For now you could copy QueryTermsExtractor and put an
"if" around these lines which tests the field name for
your choice of field.

Cheers
Mark




--- Ernesto De Santis
<ernesto.desantis@colaborativa.net> wrote:

> Hi Mark
> 
> This don't work, because
> 
>         WeightedTerm[] weightedTerm =
> QueryTermExtractor.getTerms(query);
> 
> return query terms values , not the fields names.
> example:
> for "body:mark title:highlight"
> 
> return [mark, highlight], I can't compare this
> values with "body" field.
> 
> Ernesto.
> 
> mark harwood escribió:
> 
> >Ah. You're right. Looks like the current
> highlighter
> >api doesn't offer you that degree of control.
> >
> >The way to fix it is probably to tweak the list of
> >WeightedTerms you give the highlighter:
> >[psuedo code follows...]
> >
> >terms=QueryTermExtractor.getTerms(query);
> >bodyQueryTerms=new ArrayList();
> >for all terms
> >{
> >  if terms[i].getField().equals("body")
> >     bodyQueryTerms.add(terms[i]);
> >}
> >highlighter=new Highlighter(new
> >QueryScorer(bodyQueryTerms.toarray))
> >highlighter.getBestFragments(bodyTokenStream,
> >bodyText.....
> >[end psuedo code]
> >
> >Hope this helps
> >Mark
> >
> >
> >		
>
>___________________________________________________________
> 
> >Yahoo! Model Search 2005 - Find the next catwalk
> superstars -
> http://uk.news.yahoo.com/hot/model-search/
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> java-user-unsubscribe@lucene.apache.org
> >For additional commands, e-mail:
> java-user-help@lucene.apache.org
> >
> >
> >  
> >
> 
> -- 
> Ernesto De Santis - Colaborativa.net
> La Plata, Argentina.
> http://www.colaborativa.net/
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail:
> java-user-help@lucene.apache.org
> 
> 



		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.
http://uk.security.yahoo.com

---------------------------------------------------------------------
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