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 Eugene Strokin <eu...@strokin.info> on 2011/11/05 21:43:47 UTC

Dynamic rating based on "Like" feature

Hello,
I have a task which seems trivial, but I couldn't find any related
information from Solr documentation.
So I'm asking the community for an advice.
I have relatively big amount (about 25 Millions) of documents which are
describing products.
Those products could be rated by humans and/or machines.
The rating is nothing more but just "Like" kind of points. So if someone or
something likes a product it adds +1 to the total points of the product.
I was thinking I could just have an integer field in the document, and
increment it each time when Like event is fired, and just sort  this field.
But, because Like event could come from external systems, I could
get literally thousands of such events in first few hours. And I'm not
sure that updating the document that often would be good.
This is the first question - May be there is another way to do such dynamic
rating? So more "Liked" products will be first in a search result.

The second problem, that the client is asking to have time based search
results. For example those "Likes" should not boost the document if they
are a week old, a month old, etc. Ideally, they want to set the expiration
time dynamically, but if this is a problem, it is acceptable to have some
predefined time of expiration of those "Likes", but still we are going to
need at least a week and a month thresholds.
Second question, if this is possible at all to do using Solr, if so, how?
If not, what could you suggest?

Thanks in advance,
any advice, information, anything are greatly appreciated.

Eugene S.

Re: Dynamic rating based on "Like" feature

Posted by Erick Erickson <er...@gmail.com>.
You might find some joy in ExternalFileFields. It's still a pain to update, but
at least you wouldn't be re-indexing your documents all that often.

You'd have to maintain the age somewhere else though I think. Perhaps
a database with <uniqueKey> and datestamp for each like and then just
do a count-type query for your external file field? Hmmm, there's got to be
a cleverer way to do that, but I'm drawing a blank now.

Best
Erick

On Sat, Nov 5, 2011 at 4:55 PM, Sujit Pal <su...@comcast.net> wrote:
> Hi Eugene,
>
> I proposed a solution for something similar, maybe it will help you.
>
> http://sujitpal.blogspot.com/2011/05/custom-sorting-in-solr-using-external.html
>
> -sujit
>
> On Sat, 2011-11-05 at 16:43 -0400, Eugene Strokin wrote:
>> Hello,
>> I have a task which seems trivial, but I couldn't find any related
>> information from Solr documentation.
>> So I'm asking the community for an advice.
>> I have relatively big amount (about 25 Millions) of documents which are
>> describing products.
>> Those products could be rated by humans and/or machines.
>> The rating is nothing more but just "Like" kind of points. So if someone or
>> something likes a product it adds +1 to the total points of the product.
>> I was thinking I could just have an integer field in the document, and
>> increment it each time when Like event is fired, and just sort  this field.
>> But, because Like event could come from external systems, I could
>> get literally thousands of such events in first few hours. And I'm not
>> sure that updating the document that often would be good.
>> This is the first question - May be there is another way to do such dynamic
>> rating? So more "Liked" products will be first in a search result.
>>
>> The second problem, that the client is asking to have time based search
>> results. For example those "Likes" should not boost the document if they
>> are a week old, a month old, etc. Ideally, they want to set the expiration
>> time dynamically, but if this is a problem, it is acceptable to have some
>> predefined time of expiration of those "Likes", but still we are going to
>> need at least a week and a month thresholds.
>> Second question, if this is possible at all to do using Solr, if so, how?
>> If not, what could you suggest?
>>
>> Thanks in advance,
>> any advice, information, anything are greatly appreciated.
>>
>> Eugene S.
>
>

Re: Dynamic rating based on "Like" feature

Posted by Sujit Pal <su...@comcast.net>.
Hi Eugene,

I proposed a solution for something similar, maybe it will help you.

http://sujitpal.blogspot.com/2011/05/custom-sorting-in-solr-using-external.html 

-sujit

On Sat, 2011-11-05 at 16:43 -0400, Eugene Strokin wrote:
> Hello,
> I have a task which seems trivial, but I couldn't find any related
> information from Solr documentation.
> So I'm asking the community for an advice.
> I have relatively big amount (about 25 Millions) of documents which are
> describing products.
> Those products could be rated by humans and/or machines.
> The rating is nothing more but just "Like" kind of points. So if someone or
> something likes a product it adds +1 to the total points of the product.
> I was thinking I could just have an integer field in the document, and
> increment it each time when Like event is fired, and just sort  this field.
> But, because Like event could come from external systems, I could
> get literally thousands of such events in first few hours. And I'm not
> sure that updating the document that often would be good.
> This is the first question - May be there is another way to do such dynamic
> rating? So more "Liked" products will be first in a search result.
> 
> The second problem, that the client is asking to have time based search
> results. For example those "Likes" should not boost the document if they
> are a week old, a month old, etc. Ideally, they want to set the expiration
> time dynamically, but if this is a problem, it is acceptable to have some
> predefined time of expiration of those "Likes", but still we are going to
> need at least a week and a month thresholds.
> Second question, if this is possible at all to do using Solr, if so, how?
> If not, what could you suggest?
> 
> Thanks in advance,
> any advice, information, anything are greatly appreciated.
> 
> Eugene S.