Skip to content

Contextual matching

Placing premium inventory by meaning rather than by keyword, without landing next to discount content.

An ad network wants premium automotive inventory placed against content with purchase intent, and kept away from bargain-hunting content that uses the same brand names.

MATCH DISTANCE("luxury automotive lifestyle") WITHIN 0.72
  AND DIRECTION(["purchase intent", "aspiration"]) CONE 0.3
  AND CONTRAST(
        ATTRACT ["premium brand", "high-income lifestyle"],
        REPEL   ["budget", "discount", "coupon"]
      )
NAMESPACE "adnet:publisher-inventory"
{
  "match": {
    "and": [
      { "distance": { "anchor": "luxury automotive lifestyle", "within": 0.72 } },
      { "direction": { "toward": ["purchase intent", "aspiration"], "cone": 0.3 } },
      { "contrast": {
          "attract": ["premium brand", "high-income lifestyle"],
          "repel": ["budget", "discount", "coupon"] } }
    ]
  },
  "namespace": { "include": ["adnet:publisher-inventory"] }
}

Why each clause is there

DISTANCE sets the topic floor. Unlike the finance example, this query does want a hard membership test: an ad placed against off-topic content is worse than an ad not placed. WITHIN 0.72 is a real threshold, and it is the number to tune first.

DIRECTION finds the register, not the topic. Purchase intent is a way of writing, not a subject — it shows up in a review, a comparison, a forum thread. A cone at 0.3 radians catches that quality across all of them.

CONTRAST handles the brand-safety problem. Discount content and premium content name the same manufacturers and models, so exclusion by keyword removes the good inventory along with the bad. Repelling from "budget", "discount" and "coupon" moves the composite away from the bargain register while keeping the automotive vocabulary intact.

Three clauses, one region

Each clause narrows the region the previous one left. That is worth noticing because it is also the failure mode: three conjunctive filters compound, and it is easy to end up with a query that matches almost no inventory while every clause looks individually reasonable.

Add clauses one at a time and watch the match rate. If it collapses, the newest clause is the cause.

What to adjust first

Lower the WITHIN on DISTANCE. It is the only hard threshold here, so it dominates the fill rate. Going from 0.72 to 0.6 widens the sphere considerably — remember it is a similarity floor, so lower is looser.