# How Dri finds the product the customer asked for

> How Dri turns the code or description the customer wrote into a product from your catalog, and why some lines arrive as an open question.

Source: https://vendria.com/en/ajuda/como-a-dri-encontra-o-produto

## Where to find it

The result shows up on each line of the quote, in **Quotes**: the line that
matched a product from the **Catalog**, the line that came with an open question for you
to choose and the line marked as not found. In the conversation with Dri, the
reply sums this up in counts: confirmed items, corrected codes,
issues and items not found.

The customer writes *"20 boxes of DV8020"* or sends a photo of their order, and Dri
needs to turn that into a line from **your** catalog. This is not a single
search: it is a **ladder**, and each rung is less precise than the one above. Knowing
on which rung the line matched explains why one came right on its own and another came
as an open question.

## The channels that go through the same ladder

The ladder applies to every order that arrives: text message, spreadsheet, PDF and
photo, through the conversation with Dri or through the import on screen. All four go through the
same rungs, and only one thing changes between them: the reading corrector, which only
exists for photos (see the section about it, further down).

## The code ladder

Dri tries, in order, and stops at the first rung that answers:

1. **Exact code**: what the customer wrote is, letter by letter, the code of
   an active product.
2. **Variant code**: `2875-AT-CR` lands on product `2875-AT`, with the
   variant already chosen.
3. **Alias**: an alternative code registered for the product, such as the code
   that customer uses.
4. **Without the leading prefix**: `GR-CT6002` becomes `CT6002`.
5. **Without the leading zeros**: `040141178428` becomes `40141178428`. This is common in
   orders that come from a PDF.
6. **Prefix declared by the company**: your company's administrator declares
   that the catalog writes, for example, `DV` in front; the customer wrote
   `8020`, and Dri tries `DV8020`.

If a rung returns more than one product (the same code in two catalogs, or
two prefixes that match), Dri **does not choose**: the line becomes an open question.

## The declared prefix loses to a code that exists

The prefix rung is the last and the most fragile: it is a rule about how the
catalog writes codes, not proof that this is the product. That is why,
if the code the customer wrote (`1313`) **really exists** in another
store of your company, Dri by **no** means turns it into `DV1313`.

The line becomes an **open question**, instead of silently becoming another real product. You see the
situation on the line and choose.

## When the code does not resolve it, the description comes in

If no code rung answered, Dri searches by the item's **description**.

- When the customer sent **no** code, the description search always runs.
- When they sent a code and the code failed, the description search only runs
  if the description is long and detailed. A short description next to a wrong
  code confuses more than it helps.

The description search tolerates typos **in the text** of the description. In the
**code**, it does not: a code with one wrong digit does not match by similarity: it
goes to the rescues at the end of this article.

When building an order, the description search is **precise**: it requires the terms
to match, and it does not keep dropping words until it finds something. When checking price
and stock through the conversation the search is more tolerant, because there a "not found"
costs more than an approximate result. In an order, an open question is better than
a similar product being saved.

If more than one candidate is left, it **does not choose**: it keeps the **five**
best and leaves the choice on the line.

## When nothing matches, there are still three rescues

Before marking the line as not found, Dri tries three rescues, and all
three only **suggest**; none picks the product on its own:

- **Reading twins**: the code read is one similar-looking digit away from two
  products, and it has no way of knowing which.
- **Short correction list**: the code read does not follow the code format of
  your catalog, and there are few plausible candidates.
- **Piece of a code**: `0458` is a piece of `AB10458` and of `CD20458`.

With no rescue, the line stays as **not found**, with the text the
customer wrote. See [Code not found on the quote: search, save for future or discard](/en/ajuda/codigo-nao-encontrado-na-cotacao).

## The writing corrector only exists for PHOTOS

Fixing a misread code belongs to **image** reading: in a photo, `8` and
`3` get mixed up, and the corrector knows those swaps. Typed text and spreadsheets
go through **no** corrector: there, what the customer wrote is what they meant
to write, and guessing would spoil the data.

On a photo, the corrector acts according to its confidence:

- **very confident**: corrects without flagging the line; the conversation reply
  counts those corrections in **🔁 N codes corrected automatically. Check
  them on the quote.**;
- **confident, but not very**: corrects **and** leaves the correction recorded on the
  line, for you to check;
- **not very confident**: gives up, and the line moves on to the rescues or stays as
  not found.

That is why the same list can come with more open questions when read from a photo than when read from a
spreadsheet. It is not an inconsistency: it is this rung existing in one channel and not in
the other.

## When the code matches, but the description points to another product

Even with the code resolved, Dri checks the line's description. If the code
matched a product, but the written description clearly looks more like a
"twin" of it (a product with an almost identical code), the line comes flagged for
review. The twin merely existing is not enough: the description has to point to it.

## Where the choice shows up

The open question about which product it is gets resolved **on the line** of the quote, on
screen, with the candidates right there. Through the conversation, it only shows up as a count in
the line **🔍 N issues to review calmly on the quote**. See [When Dri asks, and how to answer](/en/ajuda/quando-a-dri-pergunta-e-como-responder);
see [Line notices: the Check badge, the drawer and the review panel](/en/ajuda/avisos-da-linha).

Fixing the product of a line also teaches Dri about that customer. See
[Dri learns how each customer orders](/en/ajuda/a-dri-aprende-o-jeito-do-seu-cliente).

## Common questions

**The customer sent the code without the prefix. How does Dri know which product it is?**
By the prefix your company declared, as long as the bare code is not the
code of another real product. In that case the line becomes an open question.

**Why didn't it find the product?** The code did not match on any rung, the
description was too short to search, or the product is not active in the
catalog. Check the line for suggestions from the rescues.

**Why did it suggest and not choose?** Because more than one product fit. With
two plausible candidates, Dri leaves the choice to you.
