This approach is deprecated. For new implementations, use Smart Groups with external sources instead.Smart Groups offer:
- Built-in deduplication. Algolia automatically removes duplicates between sponsored and organic results.
- Simplified implementation. Less custom merge logic required on your backend.
- Flexible placement. Control exact positions for sponsored items.
- Optional re-ranking. Apply Algolia’s relevance ranking to sponsored products.
How the Algolia first strategy works
- User performs a search (for example, “running shoes”).
- Your app queries Algolia to retrieve the regular product results.
- Your app sends a request to the RMP, including the list of products from Algolia. This allows the RMP to avoid recommending products that are also in the regular results.
- The combined list of regular and sponsored results is sent to the frontend for display.
Requirements
To effectively implement the Algolia first strategy, your RMP must support exclusions. It should accept a list of product IDs and exclude them from its sponsored recommendations to prevent duplicate results.Pros
- The RMP handles deduplication.
Cons
- Results may be less relevant. The most relevant Algolia searches may be excluded from RMP selection.
- Slower than the parallel requests strategy. Because the RMP call must wait until the Algolia request finishes, the response time is slower than the parallel request strategy.
Example
JavaScript
How the code works
- Call Algolia. Queries Algolia to retrieve regular results and extract the product IDs.
- Call RMP. Calls the RMP with the list of product IDs. The RMP uses the product IDs to exclude already-found products.
- Merge and inject sponsored products. Inserts the returned sponsored items at the predefined positions.
- Return merged results. The frontend receives the merged list, where sponsored products are appropriately labeled.
Before your strategy goes live, ensure you’ve considered the regulatory requirements and the influence of sponsored results on your analytics, ranking, and UI.