# Metadata Filtering

- **Canonical URL:** https://getaimath.com/dictionary/metadata-filtering/
- **Topics:** [Context, Memory & Retrieval](https://getaimath.com/dictionary/category/context-memory-and-retrieval/)
- **Last updated:** 2026-11-25

## What is Metadata Filtering?

**In one sentence:** Metadata filtering narrows search results using extra information, such as date, author or category, alongside similarity.

Vector search finds similar meaning, but sometimes you also need rules like "only documents from 2025" or "only HR policies." Metadata filters apply those rules.

![Context Window vs. Memory: Your Desk vs. The Filing Cabinet — Simple cartoon comparing the AI Context Window (a small desk that can only fit a few pages right now) with External Memory & Search (a big filing cabinet where a librarian grabs just the 3 pages you need).](https://getaimath.com/diagrams/context-memory-and-retrieval.png)
*Napkin Diagram (Context, Memory & Retrieval): The context window is the small desk the AI can see right now; search grabs the right pages from the filing cabinet.*

## What is an example of Metadata Filtering?

Searching "vacation policy" but only in documents tagged "Spain office" uses metadata filtering.

## Why does Metadata Filtering matter?

It makes retrieval more precise and helps respect access rules.

## Related Concepts

- [Chroma](https://getaimath.com/dictionary/chroma/): Chroma is a free, open-source vector database designed to be simple to use for AI apps.
- [Chunking](https://getaimath.com/dictionary/chunking/): Chunking splits long documents into smaller pieces before turning them into embeddings for search.
- [FAISS](https://getaimath.com/dictionary/faiss/): FAISS is a free library from Meta for fast similarity search and clustering of vectors.
- [Chunk Size](https://getaimath.com/dictionary/chunk-size/): Chunk size is how big each piece of a split document is, usually measured in tokens or characters.
- [HNSW](https://getaimath.com/dictionary/hnsw/): HNSW, or Hierarchical Navigable Small World, is a popular ANN method that organizes vectors into layered networks for fast searching.
- [Chunk Overlap](https://getaimath.com/dictionary/chunk-overlap/): Chunk overlap repeats a little text between neighboring chunks so ideas split at the edges are not lost.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/metadata-filtering/)
