Skip to content

Commit 408fb13

Browse files
authored
Update classifier to Production/Stable and fix TODO doc links (#769)
1 parent fa65fe2 commit 408fb13

3 files changed

Lines changed: 73 additions & 7 deletions

File tree

aredis_om/model/model.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,11 +1564,17 @@ def _resolve_redisearch_query(self, expression: ExpressionOrNegated) -> str:
15641564
result += f"({self._resolve_redisearch_query(right)})"
15651565
else:
15661566
if not field_name:
1567-
raise QuerySyntaxError("Could not resolve field name. See docs: TODO")
1567+
raise QuerySyntaxError(
1568+
f"Could not resolve field name. Docs: {ERRORS_URL}#E9"
1569+
)
15681570
elif not field_type:
1569-
raise QuerySyntaxError("Could not resolve field type. See docs: TODO")
1571+
raise QuerySyntaxError(
1572+
f"Could not resolve field type. Docs: {ERRORS_URL}#E10"
1573+
)
15701574
elif not field_info:
1571-
raise QuerySyntaxError("Could not resolve field info. See docs: TODO")
1575+
raise QuerySyntaxError(
1576+
f"Could not resolve field info. Docs: {ERRORS_URL}#E11"
1577+
)
15721578
else:
15731579
result += self.__class__.resolve_value(
15741580
field_name,
@@ -3406,13 +3412,13 @@ def schema_for_type(
34063412
elif parent_is_container_type or parent_is_model_in_container:
34073413
if typ is not str:
34083414
raise RedisModelError(
3409-
"In this Preview release, list and tuple fields can only "
3410-
f"contain strings. Problem field: {name}. See docs: TODO"
3415+
"List and tuple fields can only contain strings. "
3416+
f"Problem field: {name}. Docs: {ERRORS_URL}#E12"
34113417
)
34123418
if full_text_search is True:
34133419
raise RedisModelError(
34143420
"List and tuple fields cannot be indexed for full-text "
3415-
f"search. Problem field: {name}. See docs: TODO"
3421+
f"search. Problem field: {name}. Docs: {ERRORS_URL}#E13"
34163422
)
34173423
# List/tuple fields are indexed as TAG fields and can be sortable
34183424
schema = f"{path} AS {index_field_name} TAG SEPARATOR {SINGLE_VALUE_TAG_FIELD_SEPARATOR}"

docs/errors.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,63 @@ Member.find(Member.first_name != "Andrew").all()
240240

241241
Still, `~` is useful to negate groups of expressions
242242
surrounded by parentheses.
243+
244+
## E9
245+
246+
> Could not resolve field name.
247+
248+
Redis OM encountered a query expression where it could not determine the field name. This usually indicates a malformed query. Make sure your query starts with a model field, like `Model.field_name == value`.
249+
250+
## E10
251+
252+
> Could not resolve field type.
253+
254+
Redis OM could not determine the type of a field in your query. This might happen if the field annotation is missing or invalid. Ensure your model fields have proper type annotations.
255+
256+
## E11
257+
258+
> Could not resolve field info.
259+
260+
Redis OM could not find field metadata for a field in your query. This is an internal error that shouldn't normally occur. If you see this, please file an issue on GitHub.
261+
262+
## E12
263+
264+
> List and tuple fields can only contain strings.
265+
266+
When indexing a `List` or `Tuple` field in a JsonModel, the elements must be strings. For example:
267+
268+
```python
269+
from typing import List
270+
from redis_om import JsonModel, Field
271+
272+
# This works - list of strings
273+
class Article(JsonModel):
274+
tags: List[str] = Field(index=True)
275+
276+
# This does NOT work - list of integers
277+
class Article(JsonModel):
278+
scores: List[int] = Field(index=True) # Raises E12
279+
```
280+
281+
If you need to store lists of other types, you can still do so without indexing them.
282+
283+
## E13
284+
285+
> List and tuple fields cannot be indexed for full-text search.
286+
287+
You cannot use `full_text_search=True` on a `List` or `Tuple` field. List fields are indexed as TAG fields, which support exact matching but not full-text search.
288+
289+
```python
290+
from typing import List
291+
from redis_om import JsonModel, Field
292+
293+
# This works - list with regular indexing
294+
class Article(JsonModel):
295+
tags: List[str] = Field(index=True)
296+
297+
# This does NOT work - list with full-text search
298+
class Article(JsonModel):
299+
tags: List[str] = Field(index=True, full_text_search=True) # Raises E13
300+
```
301+
302+
If you need full-text search, use a regular string field instead.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ packages = [
1212
{ "include" = "redis_om" },
1313
]
1414
classifiers = [
15-
"Development Status :: 3 - Alpha",
15+
"Development Status :: 5 - Production/Stable",
1616
"Environment :: Console",
1717
"Intended Audience :: Developers",
1818
"Operating System :: OS Independent",

0 commit comments

Comments
 (0)