You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by John Xiao <jo...@livemocha.com> on 2008/04/02 18:01:49 UTC

Sorting VS Scoring

I'm trying to figure out what the best practice is in term of using sorting
or customized scoring.

For example, if I have want to index some static pages and rank them by how
many times a page is viewed.  I can get the page view counters and store
them in the index document as a field COUNTER.  I want to be able to sort
query result in the order of most viewed pages.  I see three ways to do it:

1.       Search result sorting

Search.search(query, sort);

2.       Use the counter itself as the score

FieldScoreQuery("COUNTER", FieldScoreQuery.Type.INT);

3.       Customize scoring

Set boost on COUNTER field during index time

 

I haven't got the last one working yet.  Somehow, when I query, boost value
on the COUNTER field is ignored. 

 

Any inputs?

 

Thanks,

John X.


Re: Sorting VS Scoring

Posted by Erick Erickson <er...@gmail.com>.
Try

http://www.nabble.com/Lucene---Java-Users-f45.html

Updating may not be as easy as you think. You'll be
changing your index *every* time a user accesses it. And your
changes won't be seen until you close/reopen the searcher.

But maybe you've worked it out already....

Erick

On Wed, Apr 2, 2008 at 2:36 PM, John Xiao <jo...@livemocha.com> wrote:

> Updating index is easy, I can have a background thread to do it.
>
> Someone mentioned the "searchable archive" before, where do I find it?
>
> Thanks,
>
> -----Original Message-----
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Wednesday, April 02, 2008 11:12 AM
> To: java-user@lucene.apache.org
> Subject: Re: Sorting VS Scoring
>
> The problem here is that you'll have to keep deleting and
> adding your documents in order to update the counter field for
> all of these solutions, and I doubt that's what you really want
> to do. There is much discussion of updating a document that's
> already in the index, but I don't think it's there yet.
>
> I know this has been discussed in the mailing list, so you might
> want to search the searchable archive on this...
>
> Best
> Erick
>
> On Wed, Apr 2, 2008 at 12:01 PM, John Xiao <jo...@livemocha.com> wrote:
>
> > I'm trying to figure out what the best practice is in term of using
> > sorting
> > or customized scoring.
> >
> > For example, if I have want to index some static pages and rank them by
> > how
> > many times a page is viewed.  I can get the page view counters and store
> > them in the index document as a field COUNTER.  I want to be able to
> sort
> > query result in the order of most viewed pages.  I see three ways to do
> > it:
> >
> > 1.       Search result sorting
> >
> > Search.search(query, sort);
> >
> > 2.       Use the counter itself as the score
> >
> > FieldScoreQuery("COUNTER", FieldScoreQuery.Type.INT);
> >
> > 3.       Customize scoring
> >
> > Set boost on COUNTER field during index time
> >
> >
> >
> > I haven't got the last one working yet.  Somehow, when I query, boost
> > value
> > on the COUNTER field is ignored.
> >
> >
> >
> > Any inputs?
> >
> >
> >
> > Thanks,
> >
> > John X.
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

RE: Sorting VS Scoring

Posted by John Xiao <jo...@livemocha.com>.
Updating index is easy, I can have a background thread to do it.

Someone mentioned the "searchable archive" before, where do I find it?

Thanks,

-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com] 
Sent: Wednesday, April 02, 2008 11:12 AM
To: java-user@lucene.apache.org
Subject: Re: Sorting VS Scoring

The problem here is that you'll have to keep deleting and
adding your documents in order to update the counter field for
all of these solutions, and I doubt that's what you really want
to do. There is much discussion of updating a document that's
already in the index, but I don't think it's there yet.

I know this has been discussed in the mailing list, so you might
want to search the searchable archive on this...

Best
Erick

On Wed, Apr 2, 2008 at 12:01 PM, John Xiao <jo...@livemocha.com> wrote:

> I'm trying to figure out what the best practice is in term of using
> sorting
> or customized scoring.
>
> For example, if I have want to index some static pages and rank them by
> how
> many times a page is viewed.  I can get the page view counters and store
> them in the index document as a field COUNTER.  I want to be able to sort
> query result in the order of most viewed pages.  I see three ways to do
> it:
>
> 1.       Search result sorting
>
> Search.search(query, sort);
>
> 2.       Use the counter itself as the score
>
> FieldScoreQuery("COUNTER", FieldScoreQuery.Type.INT);
>
> 3.       Customize scoring
>
> Set boost on COUNTER field during index time
>
>
>
> I haven't got the last one working yet.  Somehow, when I query, boost
> value
> on the COUNTER field is ignored.
>
>
>
> Any inputs?
>
>
>
> Thanks,
>
> John X.
>
>


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


Re: Sorting VS Scoring

Posted by Erick Erickson <er...@gmail.com>.
The problem here is that you'll have to keep deleting and
adding your documents in order to update the counter field for
all of these solutions, and I doubt that's what you really want
to do. There is much discussion of updating a document that's
already in the index, but I don't think it's there yet.

I know this has been discussed in the mailing list, so you might
want to search the searchable archive on this...

Best
Erick

On Wed, Apr 2, 2008 at 12:01 PM, John Xiao <jo...@livemocha.com> wrote:

> I'm trying to figure out what the best practice is in term of using
> sorting
> or customized scoring.
>
> For example, if I have want to index some static pages and rank them by
> how
> many times a page is viewed.  I can get the page view counters and store
> them in the index document as a field COUNTER.  I want to be able to sort
> query result in the order of most viewed pages.  I see three ways to do
> it:
>
> 1.       Search result sorting
>
> Search.search(query, sort);
>
> 2.       Use the counter itself as the score
>
> FieldScoreQuery("COUNTER", FieldScoreQuery.Type.INT);
>
> 3.       Customize scoring
>
> Set boost on COUNTER field during index time
>
>
>
> I haven't got the last one working yet.  Somehow, when I query, boost
> value
> on the COUNTER field is ignored.
>
>
>
> Any inputs?
>
>
>
> Thanks,
>
> John X.
>
>