#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
Jul 17, 2023 (4 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 [""]

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Issue with Embedding Error in Version 0.25.0.rc63

Bill reported a bug in version 0.25.0.rc63 regarding a problem with updating or emplacing a document and receiving an embedding error. This was resolved in version 0.25.0.rc65, but further discussion ensued regarding the function of 'index' in the update feature.

5

63
4mo

Trouble in Implementing Deeply Nested Search

Anirudh is struggling to implement a two-level nested search. Jason asked for some specific examples to study the issue. Anirudh provided some material, realizing that adding top fields helped but might over-index. Jason then suggested reporting this issue on GitHub.

2

21
4d

Querying with Typesense-Js and Handling Null Values

michtio was querying using typesense-js and receiving fewer results than expected. Kishore Nallan suggested using different query parameters. Further discussion led to the handling of 'null' values and filtering syntax in the search queries. The thread ended with Jason offering migration support from Algolia to Typesense.

4

39
17mo

Issue with Document Upserting and 404 Responses

Ivy faced 404 errors during document upserting due to a nested string array field. Jason recommended parsing error messages, and a GitHub issue was created.

3

6
6mo

Large JSONL Documents Import Issue & Resolution

Suraj was having trouble loading large JSONL documents into Typesense server. After several discussions and attempts, it was discovered that the issue was due to data quality. Once the team extracted the data again, the upload process worked smoothly.

run

4

94
9mo