Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ products:
date: 2025-04-23T6:00:00Z
---

You can now filter [AutoRAG](/autorag) search results by `folder` and `modified_date` using [metadata filtering](/autorag/configuration/metadata-filtering/) to narrow down the scope of your query.
You can now filter [AutoRAG](/autorag) search results by `folder` and `timestamp` using [metadata filtering](/autorag/configuration/metadata-filtering/) to narrow down the scope of your query.

This makes it easy to build [multitenant experiences](/autorag/how-to/multitenancy/) where each user can only access their own data. By organizing your content into per-tenant folders and applying a `folder` filter at query time, you ensure that each tenant retrieves only their own documents.

Expand Down
10 changes: 5 additions & 5 deletions src/content/docs/autorag/configuration/metadata-filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const answer = await env.AI.autorag("my-autorag").search({
},
{
type: "gte",
key: "modified_date",
key: "timestamp",
value: "1735689600000", // unix timestamp for 2025-01-01
},
],
Expand All @@ -32,15 +32,15 @@ const answer = await env.AI.autorag("my-autorag").search({

## Metadata attributes

You can currently filter by the `folder` and `modified_date` of an R2 object. Currently, custom metadata attributes are not supported.
You can currently filter by the `folder` and `timestamp` of an R2 object. Currently, custom metadata attributes are not supported.

### `folder`

The directory to the object. For example, the `folder` of the object at `llama/logistics/llama-logistics.mdx` is `llama/logistics/`. Note that the `folder` does not include a leading `/`.

Note that `folder` filter only includes files exactly in that folder, so files in subdirectories are not included. For example, specifying `folder: "llama/"` will match files in `llama/` but does not match files in `llama/logistics`.

### `modified_date`
### `timestamp`

The timestamp indicating when the object was last modified. Comparisons are supported using a 13-digit Unix timestamp (milliseconds), but values will be rounded to 10 digits (seconds). For example, `1735689600999` or `2025-01-01 00:00:00.999 UTC` will be rounded down to `1735689600000`, corresponding to `2025-01-01 00:00:00 UTC`.

Expand All @@ -50,7 +50,7 @@ You can create simple comparison filters or an array of comparison filters using

### Comparison filter

You can compare a metadata attribute (for example, `folder` or `modified_date`) with a target value using a comparison filter.
You can compare a metadata attribute (for example, `folder` or `timestamp`) with a target value using a comparison filter.

```js
filters: {
Expand Down Expand Up @@ -102,7 +102,7 @@ You can see the metadata attributes of your retrieved data in the response under
"filename": "llama/logistics/llama-logistics.md",
"score": 0.45,
"attributes": {
"modified_date": 1735689600000, // unix timestamp for 2025-01-01
"timestamp": 1735689600000, // unix timestamp for 2025-01-01
"folder": "llama/logistics/",
},
"content": [
Expand Down