TECHNOLOGY

Dify automatic metadata filtering can fall back to an unfiltered search

In this article
THE QUICK TAKE

An inferred metadata condition is a convenience; use an explicit condition when the application must remain inside a particular document subset.

State the document boundary as data

A shared policy base holds regional procedures. An assistant for one region should not answer from another region merely because the wording is similar. Dify’s Agent Knowledge Retrieval node supports document metadata for this boundary. Label the documents with an explicit region or product field instead of relying only on a prompt that asks the final model to ignore irrelevant policies.

Choose field types before applying labels

The current node guide says a metadata field’s type cannot be changed later. Use a numeric type for numeric comparisons and a time type for before-or-after conditions; labels that look numeric but are stored as strings have a different contract. Source synchronization preserves document labels when updating content. Record the labeling convention so a new source does not silently enter the collection without the attribute its consuming application expects.

Distinguish Manual from Automatic filtering

Manual filtering sets the condition directly. Automatic filtering asks a model to infer conditions from the question and runs unfiltered when it cannot determine one. That fallback can be reasonable for exploratory search but fails a requirement that every request stay inside a fixed regional subset. Use Manual for that requirement and test a question that omits the region name; ordinary users should not need to repeat an internal routing label in every message.

Keep multi-base and migration rules explicit

When several bases are selected, filter fields must exist in all of them with compatible names and types. The upgrade guide carries metadata into the new base but still requires configuring filters on the replacement retrieval node. A successful upgrade therefore does not prove that the application retained its source-selection boundary. Include those conditions in the consumer cutover review, alongside the new base identifier.

Do not confuse relevance filters with access grants

The creation guide separately controls who may view a knowledge base and connect it to applications. A regional filter narrows documents inside an otherwise authorized base; it is not a substitute for resource permissions. The task-contract guide can state the intended subset, while citation-support checks verify the actual returned evidence. Test labels, configured conditions, and resulting passages together rather than trusting an appropriate-sounding assistant name.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles