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 Ding <ni...@gmail.com> on 2012/08/23 17:16:59 UTC

The way to customize ranking?

Hi

I'm working on Solr to build a local business search in China. We have a
special requirement from advertiser. When user makes a search, if the
results contain paid advertisements, those ads need to be moved on the top
of results. For different ads, they have detailed rules about which comes
first.

Could anyone offer me some suggestions how I customize the ranking based on
my requirement?

Thanks
Nicholas

Re: The way to customize ranking?

Posted by Chris Hostetter <ho...@fucit.org>.
: I'm working on Solr to build a local business search in China. We have a
: special requirement from advertiser. When user makes a search, if the
: results contain paid advertisements, those ads need to be moved on the top
: of results. For different ads, they have detailed rules about which comes
: first.

You haven't specified wether the paid ads are "global" (ie: move to the 
top of any search that they match) or search specific (ie: company A paid 
for their ad to be at the top of the searchess for X and Y, company B 
paid for their ad to be at the top of searches for Z)

If you want the later, QueryElevationComponent is perfect for you.

If you want the former then just add a field to your schema indicating the 
"ad_priority". it can be how much they paid, or a ranking number -- 
whatever you already have about the importance of the ad.  Make sure you 
either give every doc a default ad_priority, or use 'sortMissing="last"' 
in your schema.xml, and then sort on your ad_priority field before 
sorting on score...

 q=foo&sort=ad_priority+desc,score+desc


Doc: id=23, name=Ford, ad_priority=0
Doc: id=45, name=Honda Civic, ad_priority=0
...
Doc: id=99, name=Paid Ad, ad_prioriy=999999




-Hoss

Re: The way to customize ranking?

Posted by Karthick Duraisamy Soundararaj <ka...@gmail.com>.
I cant think of a way you can achieve this in one request. Can you make two
different solr requests? If so, you can make on with fq=PaidSearch:0 &
other with fq=padidSearch:[1:*] .

On Thu, Aug 23, 2012 at 11:45 AM, Nicholas Ding <ni...@gmail.com>wrote:

> Thank you, but I don't want to filter those ads.
>
> For example, when user make a search like q=Car
> Result list:
> 1. Ford Automobile (score 10)
> 2. Honda Civic (score 9)
> ...
> ...
> ...
> 99. Paid Ads (score 1, Ad has own field to identify it's an Ad)
>
> What I want to find is a way to make the score of "Paid Ads" higher than
> "Ford Automobile". Basically, the result structure will look like
>
> - [Paid Ads Section]
>     [Most valuable Ads 1]
>     [Most valuable Ads 2]
>     [Less valuable Ads 1]
>     [Less valuable Ads 2]
> - [Relevant Results Section]
>
>
> On Thu, Aug 23, 2012 at 11:33 AM, Karthick Duraisamy Soundararaj <
> karthick.soundararaj@gmail.com> wrote:
>
> > Hi
> >      You might add an int  field "Search Rule" that identifies the type
> of
> > search.
> >          example
> >             Search Rule                          Description
> >                  0                                      Unpaid Search
> >                  1                                      Paid Search -
> Rule
> > 1
> >                  2                                      Paid Serch -
> Rule 2
> >
> > You can use filterqueries (
> > http://wiki.apache.org/solr/CommonQueryParameters)
> >  like fq:  Search Rule :[1 TO *]
> >
> > Alternatively, You can even use a boolean field to identify whether or
> not
> > a search is paid and then an addtitional field that identifies the type
> of
> >  paid search.
> >
> > --
> > karthick
> >
> > On Thu, Aug 23, 2012 at 11:16 AM, Nicholas Ding <nicholasdsj@gmail.com
> > >wrote:
> >
> > > Hi
> > >
> > > I'm working on Solr to build a local business search in China. We have
> a
> > > special requirement from advertiser. When user makes a search, if the
> > > results contain paid advertisements, those ads need to be moved on the
> > top
> > > of results. For different ads, they have detailed rules about which
> comes
> > > first.
> > >
> > > Could anyone offer me some suggestions how I customize the ranking
> based
> > on
> > > my requirement?
> > >
> > > Thanks
> > > Nicholas
> > >
> >
>

Re: The way to customize ranking?

Posted by Mike Schultz <mi...@gmail.com>.
You can use CustomScoreQuery to combine a scalar field value (e.g. like the
amount of the paid placement) together with the textual relevancy.   You can
combine things anyway you want, e.g.

finalScore = textualScore + 1000.0 * scalarValue.

Or whatever makes sense.  It sounds like you want some kind of step
function, where if there is any scalar value, that overwhelms the score. 
This could do that for you.




--
View this message in context: http://lucene.472066.n3.nabble.com/The-way-to-customize-ranking-tp4002885p4003565.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: The way to customize ranking?

Posted by Nicholas Ding <ni...@gmail.com>.
Yes, I think do two separate calls to Solr could solve my problem. But I
really want to reduce the HTTP requests to Solr, if I could write a Solr
extension and place my ranking logics to inside, that could be perfect.

On Thu, Aug 23, 2012 at 5:53 PM, Savvas Andreas Moysidis <
savvas.andreas.moysidis@gmail.com> wrote:

> Could you not apply this logic in your solr client prior to displaying
> the results?
>
> On 23 August 2012 20:56, François Schiettecatte
> <fs...@gmail.com> wrote:
> > I would create two indices, one with your content and one with your ads.
> This approach would allow you to precisely control how many ads you pull
> back and how you merge them into the results, and you would be able to
> control schemas, boosting, defaults fields, etc for each index
> independently.
> >
> > Best regards
> >
> > François
> >
> > On Aug 23, 2012, at 11:45 AM, Nicholas Ding <ni...@gmail.com>
> wrote:
> >
> >> Thank you, but I don't want to filter those ads.
> >>
> >> For example, when user make a search like q=Car
> >> Result list:
> >> 1. Ford Automobile (score 10)
> >> 2. Honda Civic (score 9)
> >> ...
> >> ...
> >> ...
> >> 99. Paid Ads (score 1, Ad has own field to identify it's an Ad)
> >>
> >> What I want to find is a way to make the score of "Paid Ads" higher than
> >> "Ford Automobile". Basically, the result structure will look like
> >>
> >> - [Paid Ads Section]
> >>    [Most valuable Ads 1]
> >>    [Most valuable Ads 2]
> >>    [Less valuable Ads 1]
> >>    [Less valuable Ads 2]
> >> - [Relevant Results Section]
> >>
> >>
> >> On Thu, Aug 23, 2012 at 11:33 AM, Karthick Duraisamy Soundararaj <
> >> karthick.soundararaj@gmail.com> wrote:
> >>
> >>> Hi
> >>>     You might add an int  field "Search Rule" that identifies the type
> of
> >>> search.
> >>>         example
> >>>            Search Rule                          Description
> >>>                 0                                      Unpaid Search
> >>>                 1                                      Paid Search -
> Rule
> >>> 1
> >>>                 2                                      Paid Serch -
> Rule 2
> >>>
> >>> You can use filterqueries (
> >>> http://wiki.apache.org/solr/CommonQueryParameters)
> >>> like fq:  Search Rule :[1 TO *]
> >>>
> >>> Alternatively, You can even use a boolean field to identify whether or
> not
> >>> a search is paid and then an addtitional field that identifies the
> type of
> >>> paid search.
> >>>
> >>> --
> >>> karthick
> >>>
> >>> On Thu, Aug 23, 2012 at 11:16 AM, Nicholas Ding <nicholasdsj@gmail.com
> >>>> wrote:
> >>>
> >>>> Hi
> >>>>
> >>>> I'm working on Solr to build a local business search in China. We
> have a
> >>>> special requirement from advertiser. When user makes a search, if the
> >>>> results contain paid advertisements, those ads need to be moved on the
> >>> top
> >>>> of results. For different ads, they have detailed rules about which
> comes
> >>>> first.
> >>>>
> >>>> Could anyone offer me some suggestions how I customize the ranking
> based
> >>> on
> >>>> my requirement?
> >>>>
> >>>> Thanks
> >>>> Nicholas
> >>>>
> >>>
> >
>

Re: The way to customize ranking?

Posted by Savvas Andreas Moysidis <sa...@gmail.com>.
Could you not apply this logic in your solr client prior to displaying
the results?

On 23 August 2012 20:56, François Schiettecatte
<fs...@gmail.com> wrote:
> I would create two indices, one with your content and one with your ads. This approach would allow you to precisely control how many ads you pull back and how you merge them into the results, and you would be able to control schemas, boosting, defaults fields, etc for each index independently.
>
> Best regards
>
> François
>
> On Aug 23, 2012, at 11:45 AM, Nicholas Ding <ni...@gmail.com> wrote:
>
>> Thank you, but I don't want to filter those ads.
>>
>> For example, when user make a search like q=Car
>> Result list:
>> 1. Ford Automobile (score 10)
>> 2. Honda Civic (score 9)
>> ...
>> ...
>> ...
>> 99. Paid Ads (score 1, Ad has own field to identify it's an Ad)
>>
>> What I want to find is a way to make the score of "Paid Ads" higher than
>> "Ford Automobile". Basically, the result structure will look like
>>
>> - [Paid Ads Section]
>>    [Most valuable Ads 1]
>>    [Most valuable Ads 2]
>>    [Less valuable Ads 1]
>>    [Less valuable Ads 2]
>> - [Relevant Results Section]
>>
>>
>> On Thu, Aug 23, 2012 at 11:33 AM, Karthick Duraisamy Soundararaj <
>> karthick.soundararaj@gmail.com> wrote:
>>
>>> Hi
>>>     You might add an int  field "Search Rule" that identifies the type of
>>> search.
>>>         example
>>>            Search Rule                          Description
>>>                 0                                      Unpaid Search
>>>                 1                                      Paid Search - Rule
>>> 1
>>>                 2                                      Paid Serch - Rule 2
>>>
>>> You can use filterqueries (
>>> http://wiki.apache.org/solr/CommonQueryParameters)
>>> like fq:  Search Rule :[1 TO *]
>>>
>>> Alternatively, You can even use a boolean field to identify whether or not
>>> a search is paid and then an addtitional field that identifies the type of
>>> paid search.
>>>
>>> --
>>> karthick
>>>
>>> On Thu, Aug 23, 2012 at 11:16 AM, Nicholas Ding <nicholasdsj@gmail.com
>>>> wrote:
>>>
>>>> Hi
>>>>
>>>> I'm working on Solr to build a local business search in China. We have a
>>>> special requirement from advertiser. When user makes a search, if the
>>>> results contain paid advertisements, those ads need to be moved on the
>>> top
>>>> of results. For different ads, they have detailed rules about which comes
>>>> first.
>>>>
>>>> Could anyone offer me some suggestions how I customize the ranking based
>>> on
>>>> my requirement?
>>>>
>>>> Thanks
>>>> Nicholas
>>>>
>>>
>

Re: The way to customize ranking?

Posted by François Schiettecatte <fs...@gmail.com>.
I would create two indices, one with your content and one with your ads. This approach would allow you to precisely control how many ads you pull back and how you merge them into the results, and you would be able to control schemas, boosting, defaults fields, etc for each index independently. 

Best regards

François

On Aug 23, 2012, at 11:45 AM, Nicholas Ding <ni...@gmail.com> wrote:

> Thank you, but I don't want to filter those ads.
> 
> For example, when user make a search like q=Car
> Result list:
> 1. Ford Automobile (score 10)
> 2. Honda Civic (score 9)
> ...
> ...
> ...
> 99. Paid Ads (score 1, Ad has own field to identify it's an Ad)
> 
> What I want to find is a way to make the score of "Paid Ads" higher than
> "Ford Automobile". Basically, the result structure will look like
> 
> - [Paid Ads Section]
>    [Most valuable Ads 1]
>    [Most valuable Ads 2]
>    [Less valuable Ads 1]
>    [Less valuable Ads 2]
> - [Relevant Results Section]
> 
> 
> On Thu, Aug 23, 2012 at 11:33 AM, Karthick Duraisamy Soundararaj <
> karthick.soundararaj@gmail.com> wrote:
> 
>> Hi
>>     You might add an int  field "Search Rule" that identifies the type of
>> search.
>>         example
>>            Search Rule                          Description
>>                 0                                      Unpaid Search
>>                 1                                      Paid Search - Rule
>> 1
>>                 2                                      Paid Serch - Rule 2
>> 
>> You can use filterqueries (
>> http://wiki.apache.org/solr/CommonQueryParameters)
>> like fq:  Search Rule :[1 TO *]
>> 
>> Alternatively, You can even use a boolean field to identify whether or not
>> a search is paid and then an addtitional field that identifies the type of
>> paid search.
>> 
>> --
>> karthick
>> 
>> On Thu, Aug 23, 2012 at 11:16 AM, Nicholas Ding <nicholasdsj@gmail.com
>>> wrote:
>> 
>>> Hi
>>> 
>>> I'm working on Solr to build a local business search in China. We have a
>>> special requirement from advertiser. When user makes a search, if the
>>> results contain paid advertisements, those ads need to be moved on the
>> top
>>> of results. For different ads, they have detailed rules about which comes
>>> first.
>>> 
>>> Could anyone offer me some suggestions how I customize the ranking based
>> on
>>> my requirement?
>>> 
>>> Thanks
>>> Nicholas
>>> 
>> 


Re: The way to customize ranking?

Posted by Nicholas Ding <ni...@gmail.com>.
Thank you, but I don't want to filter those ads.

For example, when user make a search like q=Car
Result list:
1. Ford Automobile (score 10)
2. Honda Civic (score 9)
...
...
...
99. Paid Ads (score 1, Ad has own field to identify it's an Ad)

What I want to find is a way to make the score of "Paid Ads" higher than
"Ford Automobile". Basically, the result structure will look like

- [Paid Ads Section]
    [Most valuable Ads 1]
    [Most valuable Ads 2]
    [Less valuable Ads 1]
    [Less valuable Ads 2]
- [Relevant Results Section]


On Thu, Aug 23, 2012 at 11:33 AM, Karthick Duraisamy Soundararaj <
karthick.soundararaj@gmail.com> wrote:

> Hi
>      You might add an int  field "Search Rule" that identifies the type of
> search.
>          example
>             Search Rule                          Description
>                  0                                      Unpaid Search
>                  1                                      Paid Search - Rule
> 1
>                  2                                      Paid Serch - Rule 2
>
> You can use filterqueries (
> http://wiki.apache.org/solr/CommonQueryParameters)
>  like fq:  Search Rule :[1 TO *]
>
> Alternatively, You can even use a boolean field to identify whether or not
> a search is paid and then an addtitional field that identifies the type of
>  paid search.
>
> --
> karthick
>
> On Thu, Aug 23, 2012 at 11:16 AM, Nicholas Ding <nicholasdsj@gmail.com
> >wrote:
>
> > Hi
> >
> > I'm working on Solr to build a local business search in China. We have a
> > special requirement from advertiser. When user makes a search, if the
> > results contain paid advertisements, those ads need to be moved on the
> top
> > of results. For different ads, they have detailed rules about which comes
> > first.
> >
> > Could anyone offer me some suggestions how I customize the ranking based
> on
> > my requirement?
> >
> > Thanks
> > Nicholas
> >
>

Re: The way to customize ranking?

Posted by Karthick Duraisamy Soundararaj <ka...@gmail.com>.
Hi
     You might add an int  field "Search Rule" that identifies the type of
search.
         example
            Search Rule                          Description
                 0                                      Unpaid Search
                 1                                      Paid Search - Rule 1
                 2                                      Paid Serch - Rule 2

You can use filterqueries (http://wiki.apache.org/solr/CommonQueryParameters)
 like fq:  Search Rule :[1 TO *]

Alternatively, You can even use a boolean field to identify whether or not
a search is paid and then an addtitional field that identifies the type of
 paid search.

--
karthick

On Thu, Aug 23, 2012 at 11:16 AM, Nicholas Ding <ni...@gmail.com>wrote:

> Hi
>
> I'm working on Solr to build a local business search in China. We have a
> special requirement from advertiser. When user makes a search, if the
> results contain paid advertisements, those ads need to be moved on the top
> of results. For different ads, they have detailed rules about which comes
> first.
>
> Could anyone offer me some suggestions how I customize the ranking based on
> my requirement?
>
> Thanks
> Nicholas
>