You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Nicholas Clark <cl...@gmail.com> on 2012/02/17 03:47:50 UTC

Sort by the number of matching terms (coord value)

Hi,

I'm looking for a way to sort results by the number of matching terms.
Being able to sort by the coord() value or by the overlap value that gets
passed into the coord() function would do the trick. Is there a way I can
expose those values to the sort function?

I'd appreciate any help that points me in the right direction. I'm OK with
making basic code modifications.

Thanks!

-Nick

Re: Sort by the number of matching terms (coord value)

Posted by Nicholas Clark <cl...@gmail.com>.
I want to leave the score intact so I can sort by matching term frequency
and then by score. I don't think I can do that if I modify all the
similarity functions, but I think your solution would have worked otherwise.

It would be great if there was a way I could expose this information
through a function query (similar to the new relevance functions in version
4.0). I'll have to see if I can figure out how those functions work.

-Nick


On Thu, Feb 16, 2012 at 6:58 PM, Li Li <fa...@gmail.com> wrote:

> you can fool the lucene scoring fuction. override each function such as idf
> queryNorm lengthNorm and let them simply return 1.0f.
> I don't lucene 4 will expose more details. but for 2.x/3.x, lucene can only
> score by vector space model and the formula can't be replaced by users.
>
> On Fri, Feb 17, 2012 at 10:47 AM, Nicholas Clark <cl...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I'm looking for a way to sort results by the number of matching terms.
> > Being able to sort by the coord() value or by the overlap value that gets
> > passed into the coord() function would do the trick. Is there a way I can
> > expose those values to the sort function?
> >
> > I'd appreciate any help that points me in the right direction. I'm OK
> with
> > making basic code modifications.
> >
> > Thanks!
> >
> > -Nick
> >
>

Re: Sort by the number of matching terms (coord value)

Posted by Li Li <fa...@gmail.com>.
you can fool the lucene scoring fuction. override each function such as idf
queryNorm lengthNorm and let them simply return 1.0f.
I don't lucene 4 will expose more details. but for 2.x/3.x, lucene can only
score by vector space model and the formula can't be replaced by users.

On Fri, Feb 17, 2012 at 10:47 AM, Nicholas Clark <cl...@gmail.com> wrote:

> Hi,
>
> I'm looking for a way to sort results by the number of matching terms.
> Being able to sort by the coord() value or by the overlap value that gets
> passed into the coord() function would do the trick. Is there a way I can
> expose those values to the sort function?
>
> I'd appreciate any help that points me in the right direction. I'm OK with
> making basic code modifications.
>
> Thanks!
>
> -Nick
>