#community-help

Resolving Issue with Empty Arrays in the Filter

TLDR Rushil faced an issue with a filter not dismissing empty arrays. Kishore Nallan assisted them. The resolution was to input [] not [""] for an empty array.

Powered by Struct AI
22
2mo
Solved
Join the chat
Jul 17, 2023 (2 months ago)
Rushil
Photo of md5-23d3662ca8a778f4934a53bf33a66f97
Rushil
05:26 AM
Those 73k without
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:55 AM
There could be perhaps strings with special characters which become empty on indexing because special chars are dropped.
Rushil
Photo of md5-23d3662ca8a778f4934a53bf33a66f97
Rushil
06:56 AM
That is not the case, the way I have it set up is that it intentionally creates an emptry array that doesnt show up in the filter
06:57
Rushil
06:57 AM
was something changed since it used to work
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:57 AM
What version are you using now and what was the earlier version?
Rushil
Photo of md5-23d3662ca8a778f4934a53bf33a66f97
Rushil
06:58 AM
how do i check version?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:58 AM
You can check /debug endpoint
Rushil
Photo of md5-23d3662ca8a778f4934a53bf33a66f97
Rushil
06:59 AM
What I really want to know is how to make filter avoid empty arrays
07:00
Rushil
07:00 AM
I can share my schema
07:00
Rushil
07:00 AM
'name': 'companyDB',
'fields': [
{'name': 'id', 'type': 'string','facet':false },
{'name': 'company_name', 'type': 'string',"optional": true,'facet':false },
{'name': 'url_slug', 'type': 'string',"optional": true,'facet':false },
{'name': 'number_of_investments', 'type': 'string',"optional": true,'facet':false },
{'name': 'number_of_exits', 'type': 'string',"optional": true,'facet':false },
{'name': 'location', 'type': 'string',"optional": true,'facet':false },
{'name': 'investor_type', 'type': 'string[]',"optional": true,'facet':true },
{'name': 'description', 'type': 'string',"optional": true,'facet':false },
{'name': 'company_url', 'type': 'string',"optional": true,'facet':false },
{'name': 'domain', 'type': 'string',"optional": true,'facet':false },
{'name': 'facebook', 'type': 'string',"optional": true,'facet':false },
{'name': 'instagram', 'type': 'string',"optional": true,'facet':false },
{'name': 'linkedin', 'type': 'string',"optional": true,'facet':false },
{'name': 'twitter', 'type': 'string',"optional": true,'facet':false },
{'name': 'contact_email', 'type': 'string',"optional": true,'facet':false },
{'name': 'contact_email_verified?', 'type': 'string',"optional": true,'facet':false },
{'name': 'phone_number', 'type': 'string',"optional": true,'facet':false },
{'name': 'industries', 'type': 'string[]',"optional": true ,'facet':true },
{'name': 'country', 'type': 'string',"optional": true,'facet':true },
{'name': 'has_email', 'type': 'bool',"optional": true,'facet':true },
{'name': 'has_social', 'type': 'bool',"optional": true,'facet':true },
{'name': 'has_phone', 'type': 'bool',"optional": true,'facet':true },
{'name': 'ranking', 'type': 'int32',"optional": false,'facet':true, "sort":true },
{'name': 'city', 'type': 'string',"optional": true,'facet':true },
{'name': 'stage', 'type': 'string[]',"optional": true ,'facet':true },
],
'default_sorting_field': ''
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:01 AM
Can you please share a small reproducible example with maybe one or two fields?
Rushil
Photo of md5-23d3662ca8a778f4934a53bf33a66f97
Rushil
07:02 AM
{"id":"COMP047401","company_name":"Aranit Cenalla","url_slug":"aranit-cenalla","number_of_investments":"10","number_of_exits":"2","location":"Tirana, Tirane, Albania","investor_type":["Individual/Angel"],"description":"Aranit is a venture capitalist, a tech lover and businessman who is focused on investing on startup companies and well positioned businesses...","company_url":"http://www.bros.capital/","domain":"bros.capital","facebook":"","instagram":"","linkedin":"https://www.linkedin.com/in/araniti/","twitter":"","contact_email":"[email protected]","contact_email_verified?":"yes","phone_number":"","industries":[""],"country":"Albania","stage":[],"city":"Tirana","has_email":true,"has_phone":false,"has_social":true,"ranking":19}
07:03
Rushil
07:03 AM
as you can see the industries array is empty
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:04 AM
I need a small example that I can run locally to reproduce the bug. Please share an end to end example where you create a sample collection, index a sample document and query it that shows the bug in action. This will help us identify the issue and fix it. Thanks.
Rushil
Photo of md5-23d3662ca8a778f4934a53bf33a66f97
Rushil
07:04 AM
hmm wait I may have found it
07:04
Rushil
07:04 AM
when i just submit an empty []
07:04
Rushil
07:04 AM
with no quotes it seems to ignore
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:05 AM
Empty array needs to be just [ ]
Rushil
Photo of md5-23d3662ca8a778f4934a53bf33a66f97
Rushil
07:15 AM
Thank you for the assistance,
07:15
Rushil
07:15 AM
Seems something changed
07:16
Rushil
07:16 AM
I resolved
07:16
Rushil
07:16 AM
to note you have to put [] instead of [""]