Your AI Search Can Miss an Exact Product Code Sitting in Its Database

Conceptual illustration of two similar server fan modules labelled AX-1047-B and AX-1047-8, with their differing final characters highlighted. RAG
A product code is an identity, not just another piece of descriptive text. Even exhaustive vector search can return similar products while missing the exact item requested.

One character can turn a product code into a different product. A search system that is excellent at recognizing similar descriptions does not necessarily treat that character as a hard boundary.

That is how an AI search can miss an exact code that really is stored in its database. If the request becomes a vector-similarity query, the system ranks records by their numerical representations rather than requiring their product-code fields to match. The right record can fall outside the returned candidates.

Microsoft’s Azure AI Search documentation explicitly identifies product-code queries as a case where keyword search can outperform vector search. The catch is that even keyword search needs the right field and query configuration to preserve an identifier.

These two records should not be interchangeable

Consider a fictional catalog containing two replacement parts with nearly identical descriptions. The identifiers below are invented to illustrate the problem; they are not a retrieval benchmark.

Similar description. Different identity.

Requested code: AX-1047-B

AX-1047-B
Replacement cooling fan module
Catalog record A
AX-1047-8
Replacement cooling fan module
Catalog record B
The final character distinguishes the requested record from a different record. Semantic relevance alone does not establish identifier equality. No similarity scores or measured rankings are implied.

For a question such as “Which replacement module helps with cooling?”, similarity is useful. For “Show me AX-1047-B”, identity is the central requirement. Returning a different cooling module is not an adequate substitute, however relevant its description sounds.

An embedding model converts text into numerical representations used for retrieval. The identifier may influence that representation, but similarity ranking does not impose a character-by-character equality check. Choosing an embedding model suited to the material can improve retrieval without turning it into an exact lookup.

“Exact search” can mean two different things

Vector search often uses an approximate nearest-neighbor index to avoid comparing a query with every stored vector. That introduces one possible source of missed candidates. But eliminating that approximation still leaves the system ranking by vector similarity.

Qdrant’s search documentation, for example, provides an exact-search option that bypasses approximate search. It searches for the closest vectors more exhaustively. It does not reinterpret the request as “return the record whose product code equals this string.”

Exact neighbors are not exact identifiers
Method What determines a match? Code equality required?
Approximate vector search Similarity, using an approximate candidate search No
Exact vector search Similarity, without approximate nearest-neighbor search No
Identifier equality lookup A matching value in the designated identifier field Yes, under the field’s matching rules
An exact identifier match still depends on how values are stored and normalized. Case folding, whitespace and punctuation rules must be defined consistently.

This distinction changes the diagnosis. If an exhaustive vector query still ranks the requested product poorly, increasing the approximate index’s search effort will not make equality its objective.

The code needs a field that keeps its identity

Full-text search is designed to process language. Depending on the analyzer, it may split text into tokens, lowercase it or remove punctuation. Those operations are useful for prose but can conflict with the rules of a product-code system.

Elasticsearch’s keyword-field documentation describes fields for structured values such as identifiers. Its term-query documentation distinguishes precise term matching from queries against analyzed text and warns against assuming they behave alike.

A practical catalog can retain the original product code, a separately defined lookup value and descriptive text. The description supports language-based retrieval; the identifier field supports identity. Qdrant likewise documents matching a payload field against a specified value, allowing structured conditions alongside vector retrieval.

Normalization should follow the catalog’s rules. If codes are case-insensitive, normalize ingestion and query values consistently. If a hyphen or leading zero distinguishes real products, preserve it. Removing every separator to improve matching can collapse distinct identifiers into the same value.

The identifier may also need a namespace. Two suppliers can use the same code for different items. In that case, supplier plus product code identifies the record more precisely than the code alone.

Hybrid retrieval helps, but it is not an equality guarantee

A mixed question needs both capabilities: “Does AX-1047-B fit the compact chassis?” The code identifies the item; the rest asks about compatibility.

For a recognized, valid code, an application can first resolve the product within the user’s authorized scope, then retrieve supporting material associated with that product. For broader language queries, semantic retrieval remains useful. Ambiguous codes should remain ambiguous rather than silently becoming a nearby catalog item.

Azure AI Search’s hybrid approach runs text and vector retrieval in parallel and combines their ranked results. That gives lexical matches another route into the candidate set, but ranking fusion alone is not a business rule requiring the selected item to have the requested identifier.

Reranking has a similar boundary. Azure’s semantic-ranking documentation explains that it reranks an existing result set rather than searching the entire corpus again. A passage that never entered that set cannot be rescued by that reranking stage.

If identifier equality is required, preserve it as a constraint through candidate selection and answer construction. Do not leave it to a later language model to infer that one character matters.

Prove where the record disappeared

Before changing embeddings, verify what “in the database” means. A record in the source catalog may be absent from the active search index. The code might have been lost during extraction, stored only in metadata the query ignores, or changed by an optical character recognition error. These are possible failure points, not evidence of what happened in a particular system.

Follow a known record through the ingestion and retrieval stages of the RAG pipeline. Confirm the stored identifier, the active collection, the query sent to search, the applied filters and the candidates before reranking. Then check whether the selected passage actually reached the answering model.

Keep tenant and permission filters in place. A record excluded by authorization should not be made retrievable simply to improve a search test.

Evaluate identifier queries separately from descriptive questions. Include valid codes with close neighbors, nonexistent codes and supplier-specific duplicates. Measure whether the correct record reaches the model and whether the final answer preserves its identity. A nonexistent code should not receive a confident answer about the nearest-looking product.

For product codes, a useful search system knows when similarity is welcome and when it must stop at a different character.

Sources

Rate article
Add a comment