Hi,

I would simply split the query into two individual ones. One for the ordinary 
products, where you request 8 rows, and one for the sponsored ones where you 
request 2 rows and sort by a "random" field. "&sort=random_XXX desc"  where XXX 
is your random seed.

However, instead of using Elevate component, you can create a "keywords" field 
in your schema which enforces exact matching only, so that all "S" documents 
having a purchased keyword matching exactly (such as iPhone) will be selected 
for random sorting. See https://github.com/cominvent/exactmatch for an example 
of exactmatch field type. To use it for your "sponsored" query, be sure to 
quote the user query so you don't get any false matches: &q=keywords:"user 
exact query" (instead of &q.df=keywords&q=user exact query).

You could also look into Grouping http://wiki.apache.org/solr/FieldCollapsing 
to try to get this as one single query, perhaps through two distict 
&group.query requests...

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

4. okt. 2012 kl. 08:14 skrev Yash Ganthe <yas...@gmail.com>:

> Hi,
> 
> For an E-commerce website, we have stored the products as SOLR
> documents with the following fields and weights:
> Title:5
> Description:4
> 
> For some products, we need to ensure that they appear in the top ten
> results even if their relevance in the above two fields does not
> qualify them for being in top 10. For example:
> P1, P2, .... P10 are the legitimate products for a given search
> keyword "iPhone". I have S1 ... S100 as sponsored products that want
> to appear in the top 10. My policy is that only 2 of these 100
> sponsored products will be randomly chosen and shown in the top 10 so
> that the results will be: S5, S31, P1, P2, ... P8. In the next
> request, the sponsored products that gets slipped in may be S4, S99.
> 
> The QueryElevationComponent lets us specify the docIDs for keywords
> but does not let us randomize the results such that only 2 of the
> complete set of sponsored docIDs is sent in the results.
> 
> Any suggestions for implementing this would be appreciated.
> 
> Thanks,
> Yash

Reply via email to