lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin Pollock <>
Subject Subclassing QueryScorer
Date Tue, 07 May 2013 22:26:54 GMT
Hi, I want to modify how the QueryScorer selects fragments for snippeting. I
want to add a small boost for fragments that contain certain terms (e.g.
"great", "amazing") to the unique term occurrence score. But I don't want
these words to actually be highlighted, so I can't just add them to the
query (or make a WeightedSpamTerm[] myself containing both the query terms
and word list terms and pass it to the QueryScorer).

I tried to subclass and override the
getTokenScore method. But the scorer's PositionIncrementAttribute field is
private. I could change the Lucene source or copy QueryScorer's code into a
new subclass.

I can't find any examples of QueryScorer being subclassed so it seems like
there might be a better way to accomplish what I'm trying to do.

I'm using Lucene 3.5.0.


View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message