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 MoreLikeThis.like() 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.

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

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

Thanks

Saurabh


On Tue, May 10, 2011 at 1:36 PM, Saurabh Gokhale
<saurabhgokh...@gmail.com>wrote:

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

Reply via email to