You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Clemens Marschner <cm...@lanlab.de> on 2002/05/08 11:05:47 UTC

extra field for ranking

Hi,

I'd like to have an extra field added to each document where I can put some
custom "document ranks" in, i.e. PageRank or some preference how current the
document is, so that more current documents are preferred (i.e. in a course
list). Any ideas?

Clemens


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: extra field for ranking

Posted by "Che, Dong" <ch...@yahoo.com>.
IndexOrderSearcher: sort data before indexing and use
1/docID instead of score as sort field

--------------------------------------------------------------------------------

From: Che Dong 
Subject: IndexOrderSearcher: sort data before indexing
and use 1/docID instead of score as sort field 
Date: Tue, 05 Mar 2002 01:52:29 -0800 

--------------------------------------------------------------------------------

Hi all:
I think many lucene user want sort lucene results on
some certain field. but
just like Doug said: The problem is that a call to
getField() makes searches
an order of magnitude slower.


for example: many lucene apps base on database, just
sort data by date, rank
... even some complex: rank * price....
and dump into lucene index with sorted order.

when searching, with same lucene index, you can choose
return search results
with two sort method:
use IndexSearcher: return results with default sort
method by score
use IndexOrderSearcher: return results with doc added
sequence.

I tested with (float) doc and (float) 1/doc and find
1/doc more similar to
range of score.


Che Dong


beside class name, the only difference between
IndexOrderSearcher.java and
IndexSearch.java is IndexOrderSearcher use
(float) 1/docID as score field while just use score
filter results with
minScore in search() method.
diff IndexOrderSearcher.java IndexSearch.java
66,67c66,67
< /** Implements search over a single IndexReader. and
sort by document id*/
< public final class IndexOrderSearcher extends
Searcher {
---
> /** Implements search over a single IndexReader. */
> public final class IndexSearcher extends Searcher {
71c71
<   public IndexOrderSearcher(String path) throws
IOException {
---
>   public IndexSearcher(String path) throws
IOException {
76c76
<   public IndexOrderSearcher(Directory directory)
throws IOException {
---
>   public IndexSearcher(Directory directory) throws
IOException {
81c81
<   public IndexOrderSearcher(IndexReader r) {
---
>   public IndexSearcher(IndexReader r) {
119,120c119
<             //use 1/doc instead of score as sort
field
<             hq.put(new ScoreDoc(doc,  (float)
1/doc));          // update
hit queue
---
>             hq.put(new ScoreDoc(doc, score));   //
update hit queue
159,160c158
<             //use 1/doc instead of score as sort
field
<             results.collect(doc, (float) 1/doc);
---
>             results.collect(doc, score);


 --- Clemens Marschner <cm...@lanlab.de> 的正文:> Hi,
> 
> I'd like to have an extra field added to each
> document where I can put some
> custom "document ranks" in, i.e. PageRank or some
> preference how current the
> document is, so that more current documents are
> preferred (i.e. in a course
> list). Any ideas?
> 
> Clemens
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>  

_________________________________________________________
Do You Yahoo!? 
摊开你的掌心 让我看看你
http://sweepstakes.yahoo.com/2002cnuser

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>