have you considered a custom sort strategy using a ScoreDocComparator ? Inside your implementation you have access to individual doc scores and you could create a parallel (to your docs) array of floats which stores your r1,r2,r3 etc values. Then use this array to implement your int compare(ScoreDoc i, ScoreDoc j)method.
savvas. 2009/11/27 Wilson Wu <songzi0...@gmail.com> > Hi, > Thanks for your inspiration. What version(lucene 2.4 or 2.9 or > others) are you used in your project. Can you give more details fo > your suggestion, thanks. > > Wilson > > 2009/11/27 fulin tang <tangfu...@gmail.com>: > > Maybe you should take a look at the Scorer and Similarity series > > classes , they will show you how the score is calculated , make some > > change of them, and you will get what you want. > > > > We have the same problem and we get it done by write subclasses of > > DefaultSimilarity and BooleanScorer > > > > > > 2009/11/26 Uwe Schindler <u...@thetaphi.de>: > >> Read the documentation of the Document class: if you set a boost for a > >> document, it is used when indexing the fields and multiplied to each > field. > >> For the document itself no boost value is stored, so you cannot get it > (only > >> so called stored fields are retrievable). > >> > >> ----- > >> Uwe Schindler > >> H.-H.-Meier-Allee 63, D-28213 Bremen > >> http://www.thetaphi.de > >> eMail: u...@thetaphi.de > >> > >> > >>> -----Original Message----- > >>> From: Wilson Wu [mailto:songzi0...@gmail.com] > >>> Sent: Thursday, November 26, 2009 1:01 PM > >>> To: java-user@lucene.apache.org > >>> Subject: Is it a lucene bug? > >>> > >>> Hi, > >>> Recently, there is a requirement to sort the hits by both the > >>> scores of documents and the updateTime which is a field of document to > >>> mark the document's update time. We want the new document in the > >>> front and also want high score document in the front,in other words, > >>> we want to mix the score and updateTime, but not first sort by > >>> one,second by the other. So, I design a time based function f(t) to > >>> calculte each document boost to write into the index store. > >>> The result is that I can caculate a value for each document > >>> based its update time, and the value can influence the document score > >>> through adjusting the fieldNorm value. But when I lookup the boost > >>> value through the method document.getBoost() from every document in > >>> the index store, I found the boost value = 1.0. Which means I can set > >>> a document's boost value and the boost value can adjust the final > >>> score, but I can't read the boost value from the document I have > >>> searched out. > >>> Is it a bug in lucene? Thanks. I use lucene version 2.4.1. > >>> PS: Is there any other way to meet my reqirement? I think it is > >>> not a good idea to adjust document's final score through writing a > >>> document boost into the index store. Because if I want to open two > >>> interfaces to the Client: one is sorting documents only by score which > >>> is just the similarity score and has not been adjusted by boost value > >>> f(t), the other is sorting by final score which has been adjuested by > >>> boost value f(t). Thank a lot! > >>> > >>> wilson > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > >>> For additional commands, e-mail: java-user-h...@lucene.apache.org > >> > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > >> For additional commands, e-mail: java-user-h...@lucene.apache.org > >> > >> > > > > > > > > -- > > 梦的开始挣扎于城市的边缘 > > 心的远方执着在脚步的瞬间 > > 我的宿命埋藏了寂寞的永远 > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >