Tell me more ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

Based on this link http://www2002.org/CDROM/refereed/643/node6.html , I'm calculating Okapi similarity between the query document and another document as below using Lucene:

I have indexed the documents using 3 fields. I want to give higher weight to field 2 and field 3. I can't use Lucene's boost function since i'm using a my own similarity function. Can anyone suggest me a method how to give different weights to fields using this Okapi Similarity function?

This is Okapi Similarity Schema that I have used

sim(query, doc) = sum(t in terms(query), freq(t, query) * w(t, doc))

where (from the second link, slightly modified as I think the formula in the link is incorrect)

w(t, doc) = idf(t) * (k+1)*freq(t, doc) / (k*(1-b + b*ls(doc)) + freq(t, doc))
ls(doc) = len(doc)/avgdoclen

and idf(t) is idf(t) = log (totalNumIndexedDocs - docFreq + 0.5)/(docFreq + 0.5), freq(t, doc) is the frequency of term t in document doc.

Choosing b=0.25 and k = 1.2 , get

w(t, doc) = idf(t) * 2.2*freq(t, doc) / (1.2*(0.25+0.75*ls(doc)) + freq(t, doc))

(I posted the same question in Stackoverflow http://stackoverflow.com/questions/11098597/different-weights-to-lucene-fields-with-okapi-similarity did't get an answer. So I thought to post here, hope my question is not irrelevant for this forum)

share|improve this question
I have noticed your question has not received much attention. Have you tried posting your question in a forum specific to Lucene users? – Paul Jul 16 '12 at 21:28
@Paul, yes I have posted this on java-user@lucene.apache.org mailing list too, but no one gave any response. Do you know somewhere else that I can post this, that may get attention? – Kasun Jul 17 '12 at 3:12

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.