lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dragan Jotanovic" <Dragan.Jotano...@DIOSPHERE.com>
Subject RE: Sorting in lucene through Document boosting
Date Mon, 15 Sep 2008 12:08:39 GMT
Thanks Chris.

I made simple Similarity implementation:

	public float lengthNorm(String arg0, int arg1) {
		return 1f;
	}

	public float tf(float arg0) {
		return 1f;
	}

My boost values are calculated simply by calling: 
	document.setBoost(DefaultSimilarity.decodeNorm((byte)rank));

It works perfectly. I just need to check if I gain something with this,
in terms of performance and resource consumption.



-----Original Message-----
From: Chris Hostetter [mailto:hossman_lucene@fucit.org] 
Sent: Saturday, September 13, 2008 11:59 PM
To: java-user@lucene.apache.org
Subject: Re: Sorting in lucene through Document boosting


: I thought of setting boost value for documents at index time, with the
: value of my sort field, and then making custom Similarity class which
: would disregard Lucene scoring and take in evaluation only this
document
: boost.

the general idea should work, but a few things to pay attention to...

1) document boosts are folded into the fieldNorm, so make sure you don't
"setOmitNorms(true)"

2) your lengthNorm function needs to return a constant

3) you'll need to adjust your boost values so that when the fieldNorms
are 
converted to the internal 'byte' representation they are still unique
... 
with some simple experimentation you can find an approach that helps you

genreate a mapping from 1,2,3,4,5... to a,b,c,d,... where a<b<c<....



-Hoss

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message