Skip to content

Commit 8a13072

Browse files
committed
Using FileTree component and minor fixes
1 parent 092f585 commit 8a13072

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

src/content/docs/autorag/configuration/metadata-filtering.mdx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ sidebar:
55
order: 6
66
---
77

8+
import { FileTree } from "~/components"
9+
810
Metadata filtering narrows down search results based on metadata, so only relevant content is retrieved. The filter narrows down results prior to retrieval, so that you only query the scope of documents that matter.
911

1012
Here is an example of metadata filtering using [Workers Binding](/autorag/usage/workers-binding/) but it can be easily adapted to use the [REST API](/autorag/usage/rest-api/) instead.
@@ -96,12 +98,16 @@ Note the following limitations with the compound operators:
9698
You can use "starts with" filtering on the `folder` metadata attribute to search for all files and subfolders within a specific path.
9799

98100
For example, consider this file structure:
99-
```
100-
customer-a/profile.md
101-
customer-a/contracts/property/contract-1.pdf
102-
```
103101

104-
If you were to filter using an `eq` (equals) operator with `value: "customer-a/"`, it would only match files directly within that folder, like `profile.md`. It wouldn't include files in subfolders like `customer-a/contracts/`.
102+
<FileTree>
103+
- customer-a
104+
- profile.md
105+
- contracts
106+
- property
107+
- contract-1.pdf
108+
</FileTree>
109+
110+
If you were to filter using an `eq` (equals) operator with `value: "customer-a/"`, it would only match files directly within that folder, like `profile.md`. It would not include files in subfolders like `customer-a/contracts/`.
105111

106112
To recursively filter for all items starting with the path `customer-a/`, you can use the following compound filter:
107113

@@ -117,7 +123,7 @@ filters: {
117123
{
118124
type: "lte",
119125
key: "folder",
120-
value: "customer-a/z",
126+
value: "customer-a/z",
121127
},
122128
],
123129
},
@@ -126,8 +132,8 @@ filters: {
126132
This filter identifies paths starting with `customer-a/` by using:
127133

128134
- The `and` condition to combine the effects of the `gt` and `lte` conditions.
129-
- The `gt` condition to include pathes greater than the `/` ASCII character.
130-
- The `lte` condition to include pathes less than and including the lower case `z` ASCII character.
135+
- The `gt` condition to include paths greater than the `/` ASCII character.
136+
- The `lte` condition to include paths less than and including the lower case `z` ASCII character.
131137

132138
Together, these conditions effectively select paths that begin with the provided path value.
133139

src/content/docs/autorag/how-to/multitenancy.mdx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ sidebar:
55
order: 5
66
---
77

8+
import { FileTree } from "~/components"
9+
810
AutoRAG supports multitenancy by letting you segment content by tenant, so each user, customer, or workspace can only access their own data. This is typically done by organizing documents into per-tenant folders and applying [metadata filters](/autorag/configuration/metadata-filtering/) at query time.
911

1012
## 1. Organize Content by Tenant
@@ -13,11 +15,13 @@ When uploading files to R2, structure your content by tenant using unique folder
1315

1416
Example folder structure:
1517

16-
```bash
17-
customer-a/logs/
18-
customer-a/contracts/
19-
customer-b/contracts/
20-
```
18+
<FileTree>
19+
- customer-a
20+
- logs/
21+
- contracts/
22+
- customer-b
23+
- contracts/
24+
</FileTree>
2125

2226
When indexing, AutoRAG will automatically store the folder path as metadata under the `folder` attribute. It is recommended to enforce folder separation during upload or indexing to prevent accidental data access across tenants.
2327

@@ -44,10 +48,13 @@ To filter across multiple folders, or to add date-based filtering, you can use a
4448

4549
While an `eq` filter targets files at the specific folder, you'll often want to retrieve all documents belonging to a tenant regardless if there are files in its subfolders. For example, all files in `customer-a/` with a structure like:
4650

47-
```
48-
customer-a/profile.md
49-
customer-a/contracts/property/contract-1.pdf
50-
```
51+
<FileTree>
52+
- customer-a
53+
- profile.md
54+
- contracts
55+
- property
56+
- contract-1.pdf
57+
</FileTree>
5158

5259
To achieve this [starts with](/autorag/configuration/metadata-filtering/#starts-with-filter-for-folders) behavior, use a compound filter like:
5360

@@ -63,7 +70,7 @@ filters: {
6370
{
6471
type: "lte",
6572
key: "folder",
66-
value: "customer-a/z",
73+
value: "customer-a/z",
6774
},
6875
],
6976
},
@@ -72,7 +79,7 @@ filters: {
7279
This filter identifies paths starting with `customer-a/` by using:
7380

7481
- The `and` condition to combine the effects of the `gt` and `lte` conditions.
75-
- The `gt` condition to include pathes greater than the `/` ASCII character.
76-
- The `lte` condition to include pathes less than and including the lower case `z` ASCII character.
82+
- The `gt` condition to include paths greater than the `/` ASCII character.
83+
- The `lte` condition to include paths less than and including the lower case `z` ASCII character.
7784

78-
With this filter you would capture both files `profile.md` and `contract-1.pdf`.
85+
This filter captures both files `profile.md` and `contract-1.pdf`.

0 commit comments

Comments
 (0)