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 DHIVYA M <dh...@yahoo.com> on 2009/12/03 13:42:47 UTC

How to do relevancy ranking in lucene

Hi all,
Am using lucene 2.3.2.
When i search using lucene demo am getting all the results which contains the query. But i would like to restrict my results to the relevant match and not all the documents containing the query string.
 
Ex:
Query: how to search a string?
 
Response am getting is: all documents containing words - search, string
 
Desired response: I would like to compare the documents that contains both the words and the documents that contains anyone word of the query string - to find the relevant documents.
 
Kindly suggest me as how i should proceed and the details regarding this context.
Urgent help needed.
 
Thanks in advance for the timely help.
Dhivya


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

Re: How to do relevancy ranking in lucene

Posted by Erick Erickson <er...@gmail.com>.
Hmmm, I don't know the underlying scoring code well enough to answer
off the top of my head. But if you have the source code, I'd examine
the junit tests (the class names should give you a strong hint) and
start from there.

Best
Erick

On Fri, Dec 4, 2009 at 12:15 AM, DHIVYA M <dh...@yahoo.com>wrote:

> yes ofcourse but am a beginner in using lucene. So i couldnt find out where
> , in which part of the code is this ranking handled?
>
> So kindly point me out the place or the code if possible
>
> Thanks in advance,
> Dhivya
>
> --- On Thu, 3/12/09, Erick Erickson <er...@gmail.com> wrote:
>
>
> From: Erick Erickson <er...@gmail.com>
> Subject: Re: How to do relevancy ranking in lucene
> To: java-user@lucene.apache.org
> Date: Thursday, 3 December, 2009, 1:39 PM
>
>
> I don't really understand your goal here. Lucene already does this with
> it's relevancy ranking. By definition, it calculates a score for each
> document and ranks them in order of the score. This is NOT a simple
> "is the word in the document or not"....
>
> You can read about the scoring algorithm here:
> http://lucene.apache.org/java/2_1_0/scoring.html
>
> If this is way off base, can you give us some details of why
> the current ranking doesn't fit your needs?
>
> Best
> Erick
>
>
> On Thu, Dec 3, 2009 at 7:42 AM, DHIVYA M <dh...@yahoo.com>
> wrote:
>
> > Hi all,
> > Am using lucene 2.3.2.
> > When i search using lucene demo am getting all the results which contains
> > the query. But i would like to restrict my results to the relevant match
> and
> > not all the documents containing the query string.
> >
> > Ex:
> > Query: how to search a string?
> >
> > Response am getting is: all documents containing words - search, string
> >
> > Desired response: I would like to compare the documents that contains
> both
> > the words and the documents that contains anyone word of the query string
> -
> > to find the relevant documents.
> >
> > Kindly suggest me as how i should proceed and the details regarding this
> > context.
> > Urgent help needed.
> >
> > Thanks in advance for the timely help.
> > Dhivya
> >
> >
> >      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
> > http://in.yahoo.com/
>
>
>
>      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
> http://in.yahoo.com/
>

Re: How to do relevancy ranking in lucene

Posted by DHIVYA M <dh...@yahoo.com>.
yes ofcourse but am a beginner in using lucene. So i couldnt find out where , in which part of the code is this ranking handled?
 
So kindly point me out the place or the code if possible 
 
Thanks in advance,
Dhivya

--- On Thu, 3/12/09, Erick Erickson <er...@gmail.com> wrote:


From: Erick Erickson <er...@gmail.com>
Subject: Re: How to do relevancy ranking in lucene
To: java-user@lucene.apache.org
Date: Thursday, 3 December, 2009, 1:39 PM


I don't really understand your goal here. Lucene already does this with
it's relevancy ranking. By definition, it calculates a score for each
document and ranks them in order of the score. This is NOT a simple
"is the word in the document or not"....

You can read about the scoring algorithm here:
http://lucene.apache.org/java/2_1_0/scoring.html

If this is way off base, can you give us some details of why
the current ranking doesn't fit your needs?

Best
Erick


On Thu, Dec 3, 2009 at 7:42 AM, DHIVYA M <dh...@yahoo.com> wrote:

> Hi all,
> Am using lucene 2.3.2.
> When i search using lucene demo am getting all the results which contains
> the query. But i would like to restrict my results to the relevant match and
> not all the documents containing the query string.
>
> Ex:
> Query: how to search a string?
>
> Response am getting is: all documents containing words - search, string
>
> Desired response: I would like to compare the documents that contains both
> the words and the documents that contains anyone word of the query string -
> to find the relevant documents.
>
> Kindly suggest me as how i should proceed and the details regarding this
> context.
> Urgent help needed.
>
> Thanks in advance for the timely help.
> Dhivya
>
>
>      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
> http://in.yahoo.com/



      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

Re: How to do relevancy ranking in lucene

Posted by Erick Erickson <er...@gmail.com>.
I don't really understand your goal here. Lucene already does this with
it's relevancy ranking. By definition, it calculates a score for each
document and ranks them in order of the score. This is NOT a simple
"is the word in the document or not"....

You can read about the scoring algorithm here:
http://lucene.apache.org/java/2_1_0/scoring.html

If this is way off base, can you give us some details of why
the current ranking doesn't fit your needs?

Best
Erick


On Thu, Dec 3, 2009 at 7:42 AM, DHIVYA M <dh...@yahoo.com> wrote:

> Hi all,
> Am using lucene 2.3.2.
> When i search using lucene demo am getting all the results which contains
> the query. But i would like to restrict my results to the relevant match and
> not all the documents containing the query string.
>
> Ex:
> Query: how to search a string?
>
> Response am getting is: all documents containing words - search, string
>
> Desired response: I would like to compare the documents that contains both
> the words and the documents that contains anyone word of the query string -
> to find the relevant documents.
>
> Kindly suggest me as how i should proceed and the details regarding this
> context.
> Urgent help needed.
>
> Thanks in advance for the timely help.
> Dhivya
>
>
>      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
> http://in.yahoo.com/