A few questions on custom score queries: [1] I need to rank matches by some combination of keyword match, popularity and recency of the doc. I read the docs about CustomScoreQuery and seems to be a resonable fit. An alternate way of achieving my goals is to use a custom sort. What are the trade-offs between these two approaches?
[2] I implemented the CustomScoreQuery using FieldScoreQuery, but the scores I get from FieldScoreQuery dont match what I stored in the index. Here is roughly what my code looks like: /** At indexing time **/ int popularity = ...; doc.add(new Field("popularity", Integer.toString(popularity), Field.Store.YES, Field.Index.UN_TOKENIZED)); int creationTime = ...; // say this is the number of hours since a standard start time doc.add(new Field("creationTime", Integer.toString(creationTime), Field.Store.YES, Field.Index.UN_TOKENIZED)); /** At query time **/ FieldScoreQuery fsQuery = new FieldScoreQuery("popularity", FieldScoreQuery.Type.INT); CustomScoreQuery cq = new CustomScoreQuery(baseQuery, fsQuery) { public float customScore(int doc, float subQueryScore, float valSrcScore) { System.out.println("base score = " + subQueryScore + " valSrcScore = " + valSrcScore); return (subQueryScore + valSrcScore) / 2; } Questions: [a] I was expecting the valSrcScore in the print statement to return the value I stored in the popularity field in the index. Instead, I get a different value each time based on the query. And I dont know how to interpret the value that is returned. Am I doing something strange? [b] The subQueryScore that is returned in the customScore() API doesnt seem to be normalized. This makes it difficult for me to weight the different scores properly. Is there an easy way to get the normalized "text index" score in customScore() API so I can easaily weigh in the other factors relative to it? Thanks a lot in advance, Srinivas -- View this message in context: http://www.nabble.com/Question-on-custom-scoring-tf4264305.html#a12136012 Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]