lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saurabh Gokhale <>
Subject found workaround: Query on using Payload with MoreLikeThis class
Date Thu, 12 May 2011 05:00:14 GMT
Hi All,

I am not sure if any one got chance to go over my question (below).

The question was to check if I can modify result
using index time  boosting.

I have found a work around as there is no easy way to influence MoreLikeThis
result using index time payload value.

The work around is to write class similar to MoreLikeThis (can not extend
this call as it is final) and in the createQuery method of MoreLikeThis
class change the Query class from TermQuery to PayloadTermQuery.

TermQuery tq = new TermQuery(new Term((String) ar[1], (String) ar[0]));

Term payloadTerm = new Term((String) ar[1], (String) ar[0]);
Query tq = new PayloadTermQuery(payloadTerm, new AveragePayloadFunction());

Thats it, rest of the MoreLikeThis code stays the same :)

With this change, I could boost my MoreLikeThis result with the payload
value setup at the index time

If any one has any better thoughts, I would be glad to hear about them



On Tue, May 10, 2011 at 1:36 PM, Saurabh Gokhale

> Hi,
> In the Lucene 2.9.4 project, there is a requirement to boost some of the
> keywords in the document using payload.
> Now while searching, is there a way I can boost the MoreLikeThis result
> using the index time payload values?
> Or can I merge MoreLikeThis output and PayloadTermQuery output somehow to
> get the final percentage output?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message