hi community, now i'm facing one issue one filter_...
# community-help
m
hi community, now i'm facing one issue one filter_by on my search, in my collections i have nested filed if i'm try to search nested fields then condition wise it wont work, get wrong result, my schema: { "name" : "bikes_tyre", "enable_nested_fields": True, "fields" : [ { "name":"brand", "type":"string", "optional":True }, { "name": "updated_at", "type": "int64", }, # tyres: { "name": "tyre.id", "type": "int64[]", "optional": True, "index": True, "sortable": True, }, { "name": "tyre.brand", "type": "string[]", "index": True, "sortable": True, "optional": True, }, { "name": "tyre.status", "type": "string[]", "index": True, "sortable": True, "optional": True, }, ], "default_sorting_field": "updated_at", } and one document --> {'document': {'brand': 'yamaha', 'id': '0', 'tyre': [{'brand': 'yamaha', 'id': 1, 'status': 'good'}, {'brand': 'yamaha', 'id': 2, 'status': 'bad'}], 'updated_at': 121314}, 'highlight': {}, 'highlights': []} my query was --> { "q": "*", "query_by": "brand", "filter_by": "tyre.id:=1 && tyre.status:=bad", "sort_by": "updated_at:desc", } here my document i dont have the a record id =1 && status=bad -> here i got this above record as result but in my document a same record doesn't have id=1 and status = bad but the condition wont work i got this one record it checks globally my tyre if any one have id=1 and anyone have status = bad that time i got the result but it's not correct this condition should apply each record not entire tyre. so how can i achieve this ?? may if my "filter_by": "tyre.id:=1 && tyre.status:=good", that time if the result return this document the it fine but ? so what will be filter query for nested fields @Jason Bosco or any community guys help me.
j
This is not possible to do: https://github.com/typesense/typesense/issues/828 The work around would be to create one top level document for each of your objects inside your array of objects
m
okay. thank you for response
any alternative solution available ?
j
I mentioned a workaround above
👍 1