liveBook · Manning

Add-to-cart

As explained in AI-Powered Search

Add-to-cart is a user action that places a product into a shopping cart.

Add-to-cart is an e-commerce signal indicating stronger product interest than a click, though weaker interest than a purchase. Search systems use it with query and product signals to improve relevance. section 8.4

A signals-boosting model combines event types by assigning each a multiplier. One example counts clicks as 1, add-to-cart events as 10, and purchases as 25, reducing reliance on noisier clicks while retaining their volume. section 8.4

Weighted product-interest score

For a query–product pair with two clicks, one add-to-cart, and no purchases, the boost is 2 + 10 + 0 = 12. The add-to-cart event contributes five times more than the two clicks combined.

Listing 8.6 Combining multiple signal types with different weights
mixed_signal_types_aggregation_query = """ 
SELECT query, doc, ((1 * click_boost)  #1
       + (10 * add_to_cart_boost) +  #1
       (25 * purchase_boost)) AS boost FROM (  #1
  SELECT query, doc, 
    SUM(click) AS click_boost,  #2
    SUM(add_to_cart) AS add_to_cart_boost,   #2
    SUM(purchase) AS purchase_boost FROM (   #2
      SELECT lower(q.target) AS query, cap.target AS doc, 
        IF(cap.type = 'click', 1, 0) AS click, 
        IF(cap.type = 'add-to-cart', 1, 0) AS  add_to_cart, 
        IF(cap.type = 'purchase', 1, 0) AS purchase 
      FROM signals cap LEFT JOIN signals q on cap.query_id = q.query_id 
      WHERE (cap.type != 'query' AND q.type = 'query') 
    ) raw_signals 
  GROUP BY query, doc) AS per_type_boosts""" 

type_weighted_collection = \ 
    aggregate_signals(signals_collection, "signals_boosts_weighted_types", 
                      mixed_signal_types_aggregation_query)

Use the SQL aggregation to group events by query and product, count each signal type, and calculate the weighted boost. section 8.4

How AI-Powered Search covers it

How deep it goes
Explains relative signal strength and weighted SQL aggregation, without detailing model training or evaluation.
Examples
Demonstrates weighted click, add-to-cart, and purchase counts through formulas and a SQL aggregation.
What it assumes
Assumes query and click signals, then distinguishes add-to-cart interest from browsing and purchasing behavior.
What you can do after
Apply it via SQL by aggregating add-to-cart events and weighting them alongside clicks and purchases.
How it connects
Connects add-to-cart signals with query signals, click signals, purchase signals, and signals-boosting models.

This explainer was generated by Manning's knowledge graph from the text of AI-Powered Search. The section links point to the parts of the book it draws on.