Blog 2026-10-13

Similar isn't eligible: check the conditions before recommending an order

An order can look relevant to a question without meeting its conditions. If the question asks for completed orders above a threshold during October, all three conditions must hold. A convincing summary does not compensate for including a pending order or a transaction outside the window.

The Techzeen’s video on vector search versus SQL, uploaded October 8, 2026, prompted this example. Its description discusses exact matching, numerical conditions and relational retrieval. We reviewed the description, not a loaded transcript. Watch-page and player metadata titles differ. We do not treat the headline as evidence that vector search fails, and this article reports no retrieval benchmark or creator endorsement.

Write the rule before asking for a recommendation

For this fictional review queue, an order qualifies only if its status is exactly completed, its amount is at least 10,000 cents, and its completion time is on or after October 1 at midnight UTC but before November 1 at midnight UTC. Amounts use one currency. The threshold includes exactly $100. This rule identifies orders for review; it does not authorize a refund, discount or other action.

Use the completion time, not the creation time. Normalize time zones before evaluating the window. In the fixture below, timestamps are fixed-width UTC strings; production systems should use appropriate timestamp types and explicit timezone handling. Define which amount is intended—gross, net, tax-inclusive or otherwise—before applying the threshold to real records.

SELECT id FROM orders
WHERE status = 'completed'
  AND amount_cents >= 10000
  AND completed_at >= '2026-10-01T00:00:00Z'
  AND completed_at < '2026-11-01T00:00:00Z'
ORDER BY id;

The upper boundary is exclusive. That avoids inventing an end-of-month “last instant” dependent on timestamp precision and keeps adjacent monthly windows from overlapping.

The known answer is A and B

Order A is completed, exactly $100 and exactly at the October start boundary. It qualifies. B is completed, $150 and dated October 31 at 23:59:59 UTC. It also qualifies.

C is pending despite having a qualifying amount and date. D is completed in October but is one cent below the threshold. E completed just before October started. F completed exactly when November started. All four are excluded.

G has a missing amount, H a missing completion time and I a missing status. Each fails to establish a required condition. SQL comparisons with NULL do not evaluate to true, so these rows are absent from the qualifying result. Missing evidence is not proof of ineligibility: put these records in a separate data-quality review queue if the business needs a decision about them. Do not turn an unknown amount into zero or an unknown status into “completed” simply to finish the answer.

Eligibility first, ranking second

If you later want to rank qualifying orders by relevance to a narrative question, keep the exact eligibility rule visible and verify the final IDs against it. Similarity can help order candidates; it does not establish that a status, amount or date condition holds. This example does not compare embedding models or semantic search with SQL.

Ask the AI for the rule, SQL and returned IDs together. A useful answer is: “A and B meet all three conditions. C–F fail explicit conditions; G–I have missing required values.” That explanation is inspectable against the fixture. It is a suggested model exercise, not a reported AI result.

What we tested

The offline Python/SQLite fixture passed ten checks: the exact A/B result, seven individual exclusions, the qualifying boundary cases, and query-only write refusal. We did not run a live AI, a vector-search comparison, or a Bufflehead UI/MCP exchange. The write-refusal check applies to the disposable SQLite connection.

Our fixture preparation and eligibility policy are external to Bufflehead. Bufflehead supplies read-only SQL access to existing structured data; it does not define your business rules or make an automatic eligibility decision. Try Bufflehead with a known-answer query, then check every required condition before recommending an order.

Try it on your own data.

Native binary, no Docker, no cloud egress. Free for local files and direct database connections — request a demo for the AWS SSM path.

Download free Request a demo