Closed
Description
I don't think the index is getting created correctly when using a full text search field... here a field description_fts
is created in the index, but it doesn't say to use the field description
as the field to search in... so I am unable to do any full text queries on description
:
Model:
from typing import Text
from redis_om import (Field, HashModel)
class Adoptable(HashModel):
name: str = Field(index=True)
species: str = Field(index=True)
age: int = Field(index=True)
weight: float = Field(index=True)
sex: str = Field(index=True)
fee: float = Field(index=True)
children: str = Field(index=True)
other_animals: str = Field(index=True)
description: str = Field(index=True, full_text_search=True)
FT.CREATE
Redis command generated when I run migrator as seen by Redis MONITOR
command:
"ft.create" ":adoptable.Adoptable:index" "ON" "HASH" "PREFIX" "1" ":adoptable.Adoptable:" "SCHEMA" "pk" "TAG" "SEPARATOR" "|" "name" "TAG" "SEPARATOR" "|" "species" "TAG" "SEPARATOR" "|" "age" "NUMERIC" "weight" "NUMERIC" "sex" "TAG" "SEPARATOR" "|" "fee" "NUMERIC" "children" "TAG" "SEPARATOR" "|" "other_animals" "TAG" "SEPARATOR" "|" "description" "TAG" "SEPARATOR" "|" "description_fts" "TEXT"
Hashes created using .save()
don't have a description_fts
field so this doesn't appear to work. Probably needs something like this in the index create command:
"description" "AS" "description_fts" "TEXT"
I think the issue is here
redis-om-python/aredis_om/model/model.py
Line 1432 in 3a3ed91
which should likely say:
f"{name} AS {name}_fts TEXT "
Metadata
Metadata
Assignees
Labels
No labels