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 Floyd Wu <fl...@gmail.com> on 2012/11/20 03:40:46 UTC

Ranking by sorting score and rankingField better or by product(score, rankingField)?

Hi  there,

I have a field(which is externalFileField, called rankingField) and that
value(type=float) is calculated by client app.

For the solr original scoring model, affect boost value will result
different ranking. So I think product(score,rankingField) may equivalent to
solr scoring model.

What I curious is which will be better in practice and the different
meanings on these three solutions?

1. sort=score+desc,ranking+desc
2. sort=ranking+desc,score+desc
3. sort=product(score,ranking) -->is this possible?

I'd like to hear your thoughts.

Many thanks

Floyd

Re: Ranking by sorting score and rankingField better or by product(score, rankingField)?

Posted by Floyd Wu <fl...@gmail.com>.
Hi Chris,

Thanks! Before your great suggestions, I give up using function query to
calculate product of score and rankingField and using exactly the same with
your boost query solution. Of course it works fine. The next step will be
design suitable function to output a ranking value that also consider with
popularity, recency, relevance and also rating of documents.

Many thanks to the community.

Floyd



2012/11/21 Chris Hostetter <ho...@fucit.org>

>
> : But the sort=product(score, rankingField) is not working in my test. What
> : probably wrong?
>
> the problem is "score" is not a field or a function -- Solr doesn't know
> exactly what "score" you want it to use there (scores from which query?)
>
> You either need to refrence the query in the function (using the
> "query(...)" function) or you need to incorporate your function directly
> into the score (using something like the "boost" QParser).
>
> Unless you need the "score" of the docs, from your orriginal query, to be
> returned in the fl, or used in some other clause of your sort, i would
> suggest using the boost parser -- that way your final scores will match
> the scores you computed with the function...
>
>    qq=your original query
>     q={!boost b=rankingField v=$qq}
>
>
> https://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/search/BoostQParserPlugin.html
> https://people.apache.org/~hossman/ac2012eu/
>
>
> -Hoss
>

Re: Ranking by sorting score and rankingField better or by product(score, rankingField)?

Posted by Chris Hostetter <ho...@fucit.org>.
: But the sort=product(score, rankingField) is not working in my test. What
: probably wrong?

the problem is "score" is not a field or a function -- Solr doesn't know 
exactly what "score" you want it to use there (scores from which query?)

You either need to refrence the query in the function (using the 
"query(...)" function) or you need to incorporate your function directly 
into the score (using something like the "boost" QParser).

Unless you need the "score" of the docs, from your orriginal query, to be 
returned in the fl, or used in some other clause of your sort, i would 
suggest using the boost parser -- that way your final scores will match 
the scores you computed with the function...

   qq=your original query
    q={!boost b=rankingField v=$qq}

https://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/search/BoostQParserPlugin.html
https://people.apache.org/~hossman/ac2012eu/


-Hoss

Re: Ranking by sorting score and rankingField better or by product(score, rankingField)?

Posted by Steve Rowe <sa...@gmail.com>.
Thanks for the report, Floyd, the Solr Reference Guide has been changed to say the default is $SOLR_HOME/data rather than $SOLR_HOME/data/index.

Currently the ExternalFileField javadoc <http://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/schema/ExternalFileField.html> says:

	Solr looks for the external file in the index directory
        under the name of external_<fieldname> or external_<fieldname>.*"

I think the intent here is that "the index directory" is the directory *containing* the index directory, rather than the index directory itself.

Steve

On Nov 19, 2012, at 10:37 PM, Floyd Wu <fl...@gmail.com> wrote:

> By the way, I first try external field according document here
> http://lucidworks.lucidimagination.com/display/solr/Working+with+External+Files+and+Processes
> 
> "Format of the External File
> 
> The file itself is located in Solr's index directory, which by default is
> $SOLR_HOME/data/index. The name of the file should beexternal_*fieldname*
> or external_*fieldname*.*. For the example above, then, the file could be
> named external_entryRankFile orexternal_entryRankFile.txt.
> "
> 
> But actually the external file should put in
> $SOLR_HOME/data/
> 
> Floyd


Re: Ranking by sorting score and rankingField better or by product(score, rankingField)?

Posted by Floyd Wu <fl...@gmail.com>.
Hi Otis,

There is no error in console nor in log file. I'm using Solr-4.0.
The External file name is external_rankingField.txt and exist is directory
 "C:\solr-4.0.0\example\solr\collection1\data\external_rankingField.txt"

External file should work as well because when I issue query
"sort=sqrt(rankingField)+desc" or "sort=sqrt(rankingField)+asc" or
"sort=sqrt(rankingField)+desc"

Things will change accordingly.

By the way, I first try external field according document here
http://lucidworks.lucidimagination.com/display/solr/Working+with+External+Files+and+Processes

"Format of the External File

The file itself is located in Solr's index directory, which by default is
$SOLR_HOME/data/index. The name of the file should beexternal_*fieldname*
 or external_*fieldname*.*. For the example above, then, the file could be
named external_entryRankFile orexternal_entryRankFile.txt.
"

But actually the external file should put in
$SOLR_HOME/data/

Floyd




2012/11/20 Otis Gospodnetic <ot...@gmail.com>

> Hi,
>
> Do you see any errors?
> Which version of Solr?
> What does debugQuery=true say?
> Are you sure your file with ranks is being used? (remove it, put some junk
> in it, see if that gives an error)
>
> Otis
> --
> Performance Monitoring - http://sematext.com/spm/index.html
> Search Analytics - http://sematext.com/search-analytics/index.html
>
>
>
>
> On Mon, Nov 19, 2012 at 10:16 PM, Floyd Wu <fl...@gmail.com> wrote:
>
> > Thanks Otis,
> >
> > But the sort=product(score, rankingField) is not working in my test. What
> > probably wrong?
> >
> > Floyd
> >
> >
> > 2012/11/20 Otis Gospodnetic <ot...@gmail.com>
> >
> > > Hi,
> > >
> > > 3. yes, you can sort by function -
> > > http://search-lucene.com/?q=solr+sort+by+function
> > > 2. this will sort by score only when there is a tie in ranking (two
> docs
> > > have the same rank value)
> > > 1. the reverse of 2.
> > >
> > > Otis
> > > --
> > > Performance Monitoring - http://sematext.com/spm/index.html
> > > Search Analytics - http://sematext.com/search-analytics/index.html
> > >
> > >
> > >
> > >
> > > On Mon, Nov 19, 2012 at 9:40 PM, Floyd Wu <fl...@gmail.com> wrote:
> > >
> > > > Hi  there,
> > > >
> > > > I have a field(which is externalFileField, called rankingField) and
> > that
> > > > value(type=float) is calculated by client app.
> > > >
> > > > For the solr original scoring model, affect boost value will result
> > > > different ranking. So I think product(score,rankingField) may
> > equivalent
> > > to
> > > > solr scoring model.
> > > >
> > > > What I curious is which will be better in practice and the different
> > > > meanings on these three solutions?
> > > >
> > > > 1. sort=score+desc,ranking+desc
> > > > 2. sort=ranking+desc,score+desc
> > > > 3. sort=product(score,ranking) -->is this possible?
> > > >
> > > > I'd like to hear your thoughts.
> > > >
> > > > Many thanks
> > > >
> > > > Floyd
> > > >
> > >
> >
>

Re: Ranking by sorting score and rankingField better or by product(score, rankingField)?

Posted by Otis Gospodnetic <ot...@gmail.com>.
Hi,

Do you see any errors?
Which version of Solr?
What does debugQuery=true say?
Are you sure your file with ranks is being used? (remove it, put some junk
in it, see if that gives an error)

Otis
--
Performance Monitoring - http://sematext.com/spm/index.html
Search Analytics - http://sematext.com/search-analytics/index.html




On Mon, Nov 19, 2012 at 10:16 PM, Floyd Wu <fl...@gmail.com> wrote:

> Thanks Otis,
>
> But the sort=product(score, rankingField) is not working in my test. What
> probably wrong?
>
> Floyd
>
>
> 2012/11/20 Otis Gospodnetic <ot...@gmail.com>
>
> > Hi,
> >
> > 3. yes, you can sort by function -
> > http://search-lucene.com/?q=solr+sort+by+function
> > 2. this will sort by score only when there is a tie in ranking (two docs
> > have the same rank value)
> > 1. the reverse of 2.
> >
> > Otis
> > --
> > Performance Monitoring - http://sematext.com/spm/index.html
> > Search Analytics - http://sematext.com/search-analytics/index.html
> >
> >
> >
> >
> > On Mon, Nov 19, 2012 at 9:40 PM, Floyd Wu <fl...@gmail.com> wrote:
> >
> > > Hi  there,
> > >
> > > I have a field(which is externalFileField, called rankingField) and
> that
> > > value(type=float) is calculated by client app.
> > >
> > > For the solr original scoring model, affect boost value will result
> > > different ranking. So I think product(score,rankingField) may
> equivalent
> > to
> > > solr scoring model.
> > >
> > > What I curious is which will be better in practice and the different
> > > meanings on these three solutions?
> > >
> > > 1. sort=score+desc,ranking+desc
> > > 2. sort=ranking+desc,score+desc
> > > 3. sort=product(score,ranking) -->is this possible?
> > >
> > > I'd like to hear your thoughts.
> > >
> > > Many thanks
> > >
> > > Floyd
> > >
> >
>

Re: Ranking by sorting score and rankingField better or by product(score, rankingField)?

Posted by Floyd Wu <fl...@gmail.com>.
Thanks Otis,

But the sort=product(score, rankingField) is not working in my test. What
probably wrong?

Floyd


2012/11/20 Otis Gospodnetic <ot...@gmail.com>

> Hi,
>
> 3. yes, you can sort by function -
> http://search-lucene.com/?q=solr+sort+by+function
> 2. this will sort by score only when there is a tie in ranking (two docs
> have the same rank value)
> 1. the reverse of 2.
>
> Otis
> --
> Performance Monitoring - http://sematext.com/spm/index.html
> Search Analytics - http://sematext.com/search-analytics/index.html
>
>
>
>
> On Mon, Nov 19, 2012 at 9:40 PM, Floyd Wu <fl...@gmail.com> wrote:
>
> > Hi  there,
> >
> > I have a field(which is externalFileField, called rankingField) and that
> > value(type=float) is calculated by client app.
> >
> > For the solr original scoring model, affect boost value will result
> > different ranking. So I think product(score,rankingField) may equivalent
> to
> > solr scoring model.
> >
> > What I curious is which will be better in practice and the different
> > meanings on these three solutions?
> >
> > 1. sort=score+desc,ranking+desc
> > 2. sort=ranking+desc,score+desc
> > 3. sort=product(score,ranking) -->is this possible?
> >
> > I'd like to hear your thoughts.
> >
> > Many thanks
> >
> > Floyd
> >
>

Re: Ranking by sorting score and rankingField better or by product(score, rankingField)?

Posted by Otis Gospodnetic <ot...@gmail.com>.
Hi,

3. yes, you can sort by function -
http://search-lucene.com/?q=solr+sort+by+function
2. this will sort by score only when there is a tie in ranking (two docs
have the same rank value)
1. the reverse of 2.

Otis
--
Performance Monitoring - http://sematext.com/spm/index.html
Search Analytics - http://sematext.com/search-analytics/index.html




On Mon, Nov 19, 2012 at 9:40 PM, Floyd Wu <fl...@gmail.com> wrote:

> Hi  there,
>
> I have a field(which is externalFileField, called rankingField) and that
> value(type=float) is calculated by client app.
>
> For the solr original scoring model, affect boost value will result
> different ranking. So I think product(score,rankingField) may equivalent to
> solr scoring model.
>
> What I curious is which will be better in practice and the different
> meanings on these three solutions?
>
> 1. sort=score+desc,ranking+desc
> 2. sort=ranking+desc,score+desc
> 3. sort=product(score,ranking) -->is this possible?
>
> I'd like to hear your thoughts.
>
> Many thanks
>
> Floyd
>