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
