: 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

Reply via email to