PY 08: Text search across titles

Track: Code (Python client + raw REST) Prerequisite: PY_07.

The task

Use the like filter operator against item_title to find lots by keyword, useful when you know a feature, nickname, or material but not the exact designer or model value.

Starter steps

  1. Search for a keyword inside item_title using the like operator, which the API applies as a case-insensitive substring match:
rows = client.query(
    "all_watches_data",
    fields=["designer", "model", "item_title", "sale_date", "usd_price_decimal", "status"],
    filters=[{"field": "item_title", "op": "like", "value": "chronograph"}],
    sort=[{"field": "sale_date", "direction": "desc"}],
    limit=30,
)
print(len(rows))
  1. Combine the text filter with a designer filter to narrow further, using the same combined-filters pattern from PY_03:
rows = client.query(
    "all_watches_data",
    fields=["designer", "item_title", "sale_date", "usd_price_decimal"],
    filters=[
        {"field": "designer", "op": "eq", "value": "Rolex"},
        {"field": "item_title", "op": "like", "value": "chronograph"},
    ],
    limit=1000,
)
  1. Run the same like pattern against all_handbags_data with a material keyword to confirm it works the same way across tables:
bag_rows = client.query(
    "all_handbags_data",
    fields=["designer", "item_title", "sale_date", "usd_price_decimal"],
    filters=[{"field": "item_title", "op": "like", "value": "crocodile"}],
    limit=1000,
)

Expected result

rows contains only lots whose item_title contains the keyword anywhere in the string, case-insensitively. Broad keywords return many rows across many designers; narrower keywords return a small, focused set. Combining the text filter with a designer eq filter (as in the second call) returns fewer rows than either filter used alone. The handbags call confirms the same like operator behaves consistently on a different table.

Stretch challenge

Write a small function title_search(keyword, table="all_watches_data", limit=1000) that wraps the like query pattern, then call it with two related keywords describing the same feature (a full term and a common abbreviation) and compare len(rows) between them to see how vendor wording affects keyword coverage.