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:29:20 UTC

Custom ranking solutions?

Hi there,

Before ExternalFielField introduced, change document boost value to achieve
custom ranking. My client app will update each boost value for documents
daily and seem to worked fine.
Actual ranking could be predicted based on boost value. (value is
calculated based on click, recency, and rating ).

I'm now try to use ExternalFileField to do some ranking, after some test, I
did not get my expectation.

I'm doing a sort like this

sort=product(score,abs(rankingField))+desc
But the query result ranking won't change anyway.

The external file as following
doc1=3
doc2=5
doc3=9

The original score get from Solr result as fllowing
doc1=41.042
doc2=10.1256
doc3=8.2135

Expected ranking
doc1
doc3
doc2

What wrong in my test, please kindly help on this.

Floyd

Re: Custom ranking solutions?

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

Thanks! I'm using boost query to solve this problem.

Floyd




2012/11/21 Daniel Rosher <ro...@gmail.com>

> Hi
>
> The product function query needs a valuesource, not the pseudo score field.
>
> You probably need something like (with Solr 4.0):
>
> q={!lucene}*:*&sort=product(query($q),2) desc,score
> desc&fl=score,_score_:product(query($q),2),[explain]
>
> Cheers,
> Dan
>
> On Tue, Nov 20, 2012 at 2:29 AM, Floyd Wu <fl...@gmail.com> wrote:
>
> > Hi there,
> >
> > Before ExternalFielField introduced, change document boost value to
> achieve
> > custom ranking. My client app will update each boost value for documents
> > daily and seem to worked fine.
> > Actual ranking could be predicted based on boost value. (value is
> > calculated based on click, recency, and rating ).
> >
> > I'm now try to use ExternalFileField to do some ranking, after some
> test, I
> > did not get my expectation.
> >
> > I'm doing a sort like this
> >
> > sort=product(score,abs(rankingField))+desc
> > But the query result ranking won't change anyway.
> >
> > The external file as following
> > doc1=3
> > doc2=5
> > doc3=9
> >
> > The original score get from Solr result as fllowing
> > doc1=41.042
> > doc2=10.1256
> > doc3=8.2135
> >
> > Expected ranking
> > doc1
> > doc3
> > doc2
> >
> > What wrong in my test, please kindly help on this.
> >
> > Floyd
> >
>

Re: Custom ranking solutions?

Posted by Daniel Rosher <ro...@gmail.com>.
Hi

The product function query needs a valuesource, not the pseudo score field.

You probably need something like (with Solr 4.0):

q={!lucene}*:*&sort=product(query($q),2) desc,score
desc&fl=score,_score_:product(query($q),2),[explain]

Cheers,
Dan

On Tue, Nov 20, 2012 at 2:29 AM, Floyd Wu <fl...@gmail.com> wrote:

> Hi there,
>
> Before ExternalFielField introduced, change document boost value to achieve
> custom ranking. My client app will update each boost value for documents
> daily and seem to worked fine.
> Actual ranking could be predicted based on boost value. (value is
> calculated based on click, recency, and rating ).
>
> I'm now try to use ExternalFileField to do some ranking, after some test, I
> did not get my expectation.
>
> I'm doing a sort like this
>
> sort=product(score,abs(rankingField))+desc
> But the query result ranking won't change anyway.
>
> The external file as following
> doc1=3
> doc2=5
> doc3=9
>
> The original score get from Solr result as fllowing
> doc1=41.042
> doc2=10.1256
> doc3=8.2135
>
> Expected ranking
> doc1
> doc3
> doc2
>
> What wrong in my test, please kindly help on this.
>
> Floyd
>

Re: Custom ranking solutions?

Posted by Floyd Wu <fl...@gmail.com>.
HI Otis,
The debug information as following, seems there is no "product() process" .

<lst name="debug">
<str name="rawquerystring">_l_all:"測試"</str>
<str name="querystring">_l_all:"測試"</str>
<str name="parsedquery">PhraseQuery(_l_all:"測 試")</str>
<str name="parsedquery_toString">_l_all:"測 試"</str>
<lst name="explain">
<str name="222">
41.11747 = (MATCH) weight(_l_all:"測 試" in 0) [DefaultSimilarity], result
of: 41.11747 = fieldWeight in 0, product of: 4.1231055 = tf(freq=17.0),
with freq of: 17.0 = phraseFreq=17.0 1.4246359 = idf(), sum of: 0.71231794
= idf(docFreq=3, maxDocs=3) 0.71231794 = idf(docFreq=3, maxDocs=3) 7.0 =
fieldNorm(doc=0)
</str>
<str name="223">
14.246359 = (MATCH) weight(_l_all:"測 試" in 0) [DefaultSimilarity], result
of: 14.246359 = fieldWeight in 0, product of: 1.0 = tf(freq=1.0), with freq
of: 1.0 = phraseFreq=1.0 1.4246359 = idf(), sum of: 0.71231794 =
idf(docFreq=3, maxDocs=3) 0.71231794 = idf(docFreq=3, maxDocs=3) 10.0 =
fieldNorm(doc=0)
</str>
<str name="211">
10.073696 = (MATCH) weight(_l_all:"測 試" in 0) [DefaultSimilarity], result
of: 10.073696 = fieldWeight in 0, product of: 1.4142135 = tf(freq=2.0),
with freq of: 2.0 = phraseFreq=2.0 1.4246359 = idf(), sum of: 0.71231794 =
idf(docFreq=3, maxDocs=3) 0.71231794 = idf(docFreq=3, maxDocs=3) 5.0 =
fieldNorm(doc=0)
</str>
</lst>
<str name="QParser">LuceneQParser</str>
<lst name="timing">
<double name="time">6.0</double>
<lst name="prepare">
<double name="time">0.0</double>
<lst name="org.apache.solr.handler.component.QueryComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.FacetComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.HighlightComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.StatsComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.DebugComponent">
<double name="time">0.0</double>
</lst>
</lst>
<lst name="process">
<double name="time">6.0</double>
<lst name="org.apache.solr.handler.component.QueryComponent">
<double name="time">3.0</double>
</lst>
<lst name="org.apache.solr.handler.component.FacetComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.HighlightComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.StatsComponent">
<double name="time">0.0</double>
</lst>
<lst name="org.apache.solr.handler.component.DebugComponent">
<double name="time">3.0</double>
</lst>
</lst>
</lst>
</lst>


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

> Hi Floyd,
>
> Use &debugQuery=true and let's see it.:)
>
> 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:29 PM, Floyd Wu <fl...@gmail.com> wrote:
>
> > Hi there,
> >
> > Before ExternalFielField introduced, change document boost value to
> achieve
> > custom ranking. My client app will update each boost value for documents
> > daily and seem to worked fine.
> > Actual ranking could be predicted based on boost value. (value is
> > calculated based on click, recency, and rating ).
> >
> > I'm now try to use ExternalFileField to do some ranking, after some
> test, I
> > did not get my expectation.
> >
> > I'm doing a sort like this
> >
> > sort=product(score,abs(rankingField))+desc
> > But the query result ranking won't change anyway.
> >
> > The external file as following
> > doc1=3
> > doc2=5
> > doc3=9
> >
> > The original score get from Solr result as fllowing
> > doc1=41.042
> > doc2=10.1256
> > doc3=8.2135
> >
> > Expected ranking
> > doc1
> > doc3
> > doc2
> >
> > What wrong in my test, please kindly help on this.
> >
> > Floyd
> >
>

Re: Custom ranking solutions?

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

I'm doing some test like this,

http://localhost:8983/solr/select/?fl=score,_l_unique_key&defType=func&q=product(abs(rankingField),abs(score))<http://localhost:8983/solr/select/?fl=score,_l_unique_key&defType=func&q=product(abs(ranking),abs(score))>

and I get following response,

<lst name="error">
<str name="msg">can not use FieldCache on unindexed field: score</str>
<int name="code">400</int>
</lst>

if change score to rankingField like this

http://localhost:8983/solr/select/?fl=score,_l_unique_key&defType=func&q=product(abs(rankingField),abs(rankingField))<http://localhost:8983/solr/select/?fl=score,_l_unique_key&defType=func&q=product(abs(ranking),abs(score))>

<result name="response" numFound="3" start="0" maxScore="2500.0">
<doc>
<str name="_l_unique_key">211</str>
<float name="score">2500.0</float>
</doc>
<doc>
<str name="_l_unique_key">223</str>
<float name="score">4.0</float>
</doc>
<doc>
<str name="_l_unique_key">222</str>
<float name="score">0.010000001</float>
</doc>
</result>

Seems like score could not put into function query?

Floyd




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

> Hi Floyd,
>
> Use &debugQuery=true and let's see it.:)
>
> 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:29 PM, Floyd Wu <fl...@gmail.com> wrote:
>
> > Hi there,
> >
> > Before ExternalFielField introduced, change document boost value to
> achieve
> > custom ranking. My client app will update each boost value for documents
> > daily and seem to worked fine.
> > Actual ranking could be predicted based on boost value. (value is
> > calculated based on click, recency, and rating ).
> >
> > I'm now try to use ExternalFileField to do some ranking, after some
> test, I
> > did not get my expectation.
> >
> > I'm doing a sort like this
> >
> > sort=product(score,abs(rankingField))+desc
> > But the query result ranking won't change anyway.
> >
> > The external file as following
> > doc1=3
> > doc2=5
> > doc3=9
> >
> > The original score get from Solr result as fllowing
> > doc1=41.042
> > doc2=10.1256
> > doc3=8.2135
> >
> > Expected ranking
> > doc1
> > doc3
> > doc2
> >
> > What wrong in my test, please kindly help on this.
> >
> > Floyd
> >
>

Re: Custom ranking solutions?

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

Use &debugQuery=true and let's see it.:)

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:29 PM, Floyd Wu <fl...@gmail.com> wrote:

> Hi there,
>
> Before ExternalFielField introduced, change document boost value to achieve
> custom ranking. My client app will update each boost value for documents
> daily and seem to worked fine.
> Actual ranking could be predicted based on boost value. (value is
> calculated based on click, recency, and rating ).
>
> I'm now try to use ExternalFileField to do some ranking, after some test, I
> did not get my expectation.
>
> I'm doing a sort like this
>
> sort=product(score,abs(rankingField))+desc
> But the query result ranking won't change anyway.
>
> The external file as following
> doc1=3
> doc2=5
> doc3=9
>
> The original score get from Solr result as fllowing
> doc1=41.042
> doc2=10.1256
> doc3=8.2135
>
> Expected ranking
> doc1
> doc3
> doc2
>
> What wrong in my test, please kindly help on this.
>
> Floyd
>