lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Toy <jason...@gmail.com>
Subject how to implement per doc weighting
Date Thu, 08 Dec 2011 04:08:37 GMT
I've been reading the solr source code and made modifications by
implementing a custom Similarity class.
I want to implement a weight to the score by multiplying a number
based on if the current doc has certain term in it.

So if the query was q=data_text:foo

then the Similiarity class would apply a weight of :

if this.doc.containsTerm("bar")
  weight = 5;
else
  weight = 1;
end


I don't see how the Similarity class can get access to the doc and its
terms.  Is there a way to do this?

Alternatively I could preprocess the weights and I was looking into
ExternalFileField,  but I can't tell if that is the right solution.
If you use ExternalFileField it sets the rank of the results and not a
weight?  It seems like ExternalFileField is only to be used for
function queries? Is it possible to sort by
product(score,weight_from_external_file_field)?  I also have 10's of
millions of docs so I  am not sure if this is this will work.

Mime
View raw message