Re: Customise score

2014-07-03 Thread rachun
Hi Jack,

I just found out that the sort it doesn't work right for the next page. The
response result show that numFound:23850. So I tried this

.../select?q=MacBooksort=sum(base_score,query($q,0))+descwt=jsonindent=truestart=100

The summary of base_score and document sort at the next page should not be
greater than the previous page but it does.
So, I would like to ask you a few questions

1) sort=sum(base_score,query($q,0))+desc   does it sort the whole result or
just the current page?
2) sum(base_score,query($q,0)) I curious  0 does it mean boost score?
3) if this solution it doesn't work for me could you please suggest me other
solution?


Thank you very much for your help,
Chun.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145417.html
Sent from the Solr - User mailing list archive at Nabble.com.


Customise score

2014-07-02 Thread rachun
Dear all,

Could anybody suggest me how to customize the score?
So, I have data like this ..

{ID : '0001', Title :'MacBookPro',Price: 400,Base_score:'121.2'}
{ID : '0002', Title :'MacBook',Price: 350,Base_score:'100.2'}
{ID : '0003', Title :'Laptop',Price: 300,Base_score:'155.7'}

Notice that I have ID field for uniqueKey.
When I query q=MacBook  sort=score desc
it will return result something like this

{ID : '0002', Title :'MacBook',Price: 350,Base_score:'100.2',score:1.45}
{ID : '0001', Title :'MacBookPro',Price: 400,Base_score:'121.2',score:1.11}

But I want solr to produce score by also using my Base_score. The score
should be something like this

- score = 100.2 + 1.45 = 101.65
- score = 121.2 + 1.11 = 122.31

Then the result should be something like this..

{ID : '0001', Title :'MacBookPro',Price:
400,Base_score:'121.2',score:122.31}
{ID : '0002', Title :'MacBook',Price: 350,Base_score:'100.2',score:101.65}

I'm not familia with Java so I can't write my own function as somebody do.
So, which is the easiest way to do this work using existing function from
solr?

Thank you very much,
Chun.




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customise score

2014-07-02 Thread Gora Mohanty
On 2 July 2014 20:32, rachun rachun.c...@gmail.com wrote:
 Dear all,

 Could anybody suggest me how to customize the score?
 So, I have data like this ..

 {ID : '0001', Title :'MacBookPro',Price: 400,Base_score:'121.2'}
 {ID : '0002', Title :'MacBook',Price: 350,Base_score:'100.2'}
 {ID : '0003', Title :'Laptop',Price: 300,Base_score:'155.7'}

 Notice that I have ID field for uniqueKey.
 When I query q=MacBook  sort=score desc
 it will return result something like this

 {ID : '0002', Title :'MacBook',Price: 350,Base_score:'100.2',score:1.45}
 {ID : '0001', Title :'MacBookPro',Price: 400,Base_score:'121.2',score:1.11}

 But I want solr to produce score by also using my Base_score. The score
 should be something like this

 - score = 100.2 + 1.45 = 101.65
 - score = 121.2 + 1.11 = 122.31

You should use Solr's sum function query:
http://wiki.apache.org/solr/FunctionQuery#sum
q=MacBooksort=sum(Base_score, score)+desc should do it.

Regards,
Gora


Re: Customise score

2014-07-02 Thread rachun
Gora,
firstly I would like thank you for your quick response.

.../select?q=MacBooksort=SUM(base_score, score)+descwt=jsonindent=true

I tried that but it didn't work and I got this error message 

error:{
msg:Can't determine a Sort Order (asc or desc) in sort spec
'SUM(base_score, score) desc', pos=15,
code:400}}

Best Regards,
Chun




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145216.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customise score

2014-07-02 Thread Ahmet Arslan
Hi,


Why did you use upper case? What happens when you use : sort=sum(...



On Wednesday, July 2, 2014 6:23 PM, rachun rachun.c...@gmail.com wrote:



Gora,
firstly I would like thank you for your quick response.

.../select?q=MacBooksort=SUM(base_score, score)+descwt=jsonindent=true

I tried that but it didn't work and I got this error message 

error:{
    msg:Can't determine a Sort Order (asc or desc) in sort spec
'SUM(base_score, score) desc', pos=15,
    code:400}}

Best Regards,
Chun




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145216.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: Customise score

2014-07-02 Thread Jack Krupansky
I think the white space after the comma  is the culprit. No white space is 
allowed in function queries that are embedded, such as in the sort 
parameter.


-- Jack Krupansky

-Original Message- 
From: Ahmet Arslan

Sent: Wednesday, July 2, 2014 2:19 PM
To: solr-user@lucene.apache.org
Subject: Re: Customise score

Hi,


Why did you use upper case? What happens when you use : sort=sum(...



On Wednesday, July 2, 2014 6:23 PM, rachun rachun.c...@gmail.com wrote:



Gora,
firstly I would like thank you for your quick response.

.../select?q=MacBooksort=SUM(base_score, score)+descwt=jsonindent=true

I tried that but it didn't work and I got this error message

error:{
   msg:Can't determine a Sort Order (asc or desc) in sort spec
'SUM(base_score, score) desc', pos=15,
   code:400}}

Best Regards,
Chun




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145216.html
Sent from the Solr - User mailing list archive at Nabble.com. 



Re: Customise score

2014-07-02 Thread rachun
Hi Ahmet,
I also tried this 
.../select?q=MacBooksort=sum(base_score, score)+descwt=jsonindent=true

I got the same error 

error:{
msg:Can't determine a Sort Order (asc or desc) in sort spec
'sum(base_score, score) desc', pos=15,
code:400}}

Best regards,
Chun



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145320.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customise score

2014-07-02 Thread rachun
Hi Jack,

I tried as you suggest 

.../select?q=MacBooksort=sum(base_score,score)+descwt=jsonindent=true 

but it didn't work and I got this error message

 error:{
msg:sort param could not be parsed as a query, and is not a field
that exists in the index: sum(base_score,score),
code:400}}

so, when I try something like this

.../select?q=MacBooksort=sum(base_score,base_score)+descwt=jsonindent=true 

it works fine.
How to archive this, any idea?

Best Regards,
Chun





--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145322.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Customise score

2014-07-02 Thread Jack Krupansky
You probably don't have a field named score. That said, the Solr error 
message is not very useful at all!


If you want to reference the document score, I don't think there is a direct 
way to do it, but you can indirectly by using the query function:


.../select?q=MacBooksort=sum(base_score,query($q,0))+descwt=jsonindent=true

-- Jack Krupansky

-Original Message- 
From: rachun

Sent: Wednesday, July 2, 2014 7:44 PM
To: solr-user@lucene.apache.org
Subject: Re: Customise score

Hi Jack,

I tried as you suggest

.../select?q=MacBooksort=sum(base_score,score)+descwt=jsonindent=true

but it didn't work and I got this error message

error:{
   msg:sort param could not be parsed as a query, and is not a field
that exists in the index: sum(base_score,score),
   code:400}}

so, when I try something like this

.../select?q=MacBooksort=sum(base_score,base_score)+descwt=jsonindent=true

it works fine.
How to archive this, any idea?

Best Regards,
Chun





--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145322.html
Sent from the Solr - User mailing list archive at Nabble.com. 



Re: Customise score

2014-07-02 Thread rachun
 Hi, Jack,

Thank you very much for you solution its works!

I'm sorry that I didn't make it clear at the beginning for 'score' which i
mean document score (solr produce it at query time).

Thank you very much for all of you,
Chun.








--
View this message in context: 
http://lucene.472066.n3.nabble.com/Customise-score-tp4145214p4145359.html
Sent from the Solr - User mailing list archive at Nabble.com.