Closed andrewayoub closed 5 years ago
Verifications Steps: 1- Create data and schema
data = [ {"name": "test1", "content": "lorem epsum"} ]
schema = """
@url = test.docsites
name* = (S)
content*** = (S)
"""
2- Get model
bcdb = j.data.bcdb.get("test")
bcdb.reset()
model = bcdb.model_get_from_schema(schema)
3- Save the data
for obj in data:
o = model.new()
o.name = obj["name"]
o.content = obj["content"]
o.save()
4- Search for the data ad assert
res = model.search("lorem")
assert res[0].name == "test1"
Commit: https://github.com/threefoldtech/jumpscaleX/commit/ec950fb84c81bcdb372e9ad880f9 branch: development_jumpscale
when you add *** to a field in the schema this should index this field in sonic server so you can perform full text search on it