You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-14Lines changed: 12 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,7 +216,7 @@ Next, we'll show you the **rich query expressions** and **embedded models** Redi
216
216
217
217
Redis OM comes with a rich query language that allows you to query Redis with Python expressions.
218
218
219
-
To show how this works, we'll make a small change to the `Customer` model we defined earlier. We'll add `Field(index=True)` to tell Redis OM that we want to index the `last_name` and `age` fields:
219
+
To show how this works, we'll make a small change to the `Customer` model we defined earlier. We'll add `index=True` to the model class to tell Redis OM that we want to index all fields in the model:
220
220
221
221
```python
222
222
import datetime
@@ -225,18 +225,17 @@ from typing import Optional
225
225
from pydantic import EmailStr
226
226
227
227
from redis_om import (
228
-
Field,
229
228
HashModel,
230
229
Migrator
231
230
)
232
231
233
232
234
-
classCustomer(HashModel):
233
+
classCustomer(HashModel, index=True):
235
234
first_name: str
236
-
last_name: str= Field(index=True)
235
+
last_name: str
237
236
email: EmailStr
238
237
join_date: datetime.date
239
-
age: int= Field(index=True)
238
+
age: int
240
239
bio: Optional[str] =None
241
240
242
241
@@ -294,14 +293,13 @@ class Address(EmbeddedJsonModel):
0 commit comments