#community-help

Typesense Cloud Filter Expression Issue

TLDR Samuel experienced a "Filter expression is not valid" error on a previously working query. Kishore Nallan assisted in troubleshooting and discovered it was a Scoped Search token formatting issue on Samuel's end.

Powered by Struct AI

2

32
6mo
Solved
Join the chat
Jun 09, 2023 (6 months ago)
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
08:45 AM
Hello 👋 , we use typesense already for some time but strangely this morning we started to get Filter expression is not valid. on queries we didn't change in any way
08:46
Samuel
08:46 AM
Is there any outage or were clusters upgraded ? We are using typesense cloud
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:46 AM
👋 Please DM me your cluster ID.
08:48
Kishore Nallan
08:48 AM
No changes to the cluster configuration.
08:48
Kishore Nallan
08:48 AM
No infra change as well.
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
08:49 AM
Thanks for info - is there any way to learn more what is wrong with filter expression ? Any logs ?
08:50
Samuel
08:50 AM
I have only simple filter_by expression which worked until now (we really didn't do any change to code) for past week
08:50
Samuel
08:50 AM
Image 1 for
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:50 AM
One reason this could happen is if your filter expression is really long. We have some limitations on the size to prevent abuse.
08:50
Kishore Nallan
08:50 AM
Hmm that looks fine to me. Are you able to reproduce the issue on Typesense Cloud UI for that collection?
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
08:51 AM
I'm not sure how to write such query in typesense UI
08:52
Samuel
08:52 AM
Image 1 for
08:52
Samuel
08:52 AM
ah sorry now I see Facet & Filter By field
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:53 AM
Go to the console:

https://cloud.typesense.org/clusters/<CLUSTER_ID>/collections/<COLL_NAME>/documents/search
08:53
Kishore Nallan
08:53 AM
Yup that.
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
08:54 AM
sorry again, how I should put that filter_by into that input?
Image 1 for sorry again, how I should put that filter_by into that input?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:55 AM
Wait, you can just add the filter by expression as additional params at the last
08:57
Kishore Nallan
08:57 AM
Paste the filter clause for me, I can try as well
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
08:57 AM
filter_by: properties.WORK.assignee.value:=[MY1F91qSWDVS3YEdFuMId0mBCcf1]
Image 1 for ```filter_by: properties.WORK.assignee.value:=[MY1F91qSWDVS3YEdFuMId0mBCcf1]```
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:59 AM
Correct format is:

filter_by=properties.WORK.assignee.value:=[MY1F91qSWDVS3YEdFuMId0mBCcf1]

But the UI I think is having trouble with that. I tried

filter_by=properties.WORK.assignee.value:[MY1F91qSWDVS3YEdFuMId0mBCcf1]

which works but returns no results. Let me try against your API directly. Can I have your permission for that?

1

Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
08:59 AM
Sure thing, you have permission to do that
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:02 AM
Ok when I run, I don't get an error, but I get no documents
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
09:02 AM
Oh no, I'm very sorry I probably know where is the problem
09:03
Samuel
09:03 AM
we are creating Scoped Search token for ability to do per-user filter
09:03
Samuel
09:03 AM
and there is probably issue with format of that token -&gt; and It's not obvious as It's not included in actual query but hashed
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:03 AM
Ah I see, yes
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
09:03 AM
so I made a mistake and thought that It's not an issue on our side
09:04
Samuel
09:04 AM
I'm very sorry for taking your time
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:04 AM
No worries, you did bring out a quirk with the Cloud UI. We will take that up!
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
09:04 AM
also grateful for your support
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:04 AM
:yw:
Samuel
Photo of md5-7f4ba9a2fc0e9dd5200c8ff347f1ea6e
Samuel
09:04 AM
thx, have a nice day 👋

1

Typesense

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

Indexed 3005 threads (79% resolved)

Join Our Community

Similar Threads

Phrase Search Relevancy and Weights Fix

Jan reported an issue with phrase search relevancy using Typesense Instantsearch Adapter. The problem occurred when searching phrases with double quotes. The team identified the issue to be related to weights and implemented a fix, improving the search results.

6

111
8mo
Solved

Fixing Multiple Document Retrieval in Typesense

Phil needed an efficient way to retrieve multiple documents by id. Kishore Nallan proposed a solution available in a pre-release build. After some bug fixing regarding id matching by Jason and Kishore Nallan, Phil successfully tested the solution.

4

26
26mo
Solved

Performance Characteristics of Filtering Search Results

Oskar queries the performance difference in filtering search results. Jason clarifies how filters work and provides performance improvement suggestions like increasing vCPUs and sharding the collection. Kishore Nallan explains filter IDs and document ID matching. The thread concludes with discussions on performance tradeoffs in filter implementation.

33
15mo
Solved

Docsearch Scrapper Metadata Configuration and Filter Problem

Marcos faced issues with Docsearch scrapper not adding metadata attributes and filtering out documents without content. Jason helped fix the issue by updating the scraper and providing filtering instructions.

2

82
8mo
Solved

Resolving Typesense Cloud Cluster Issue with Cron Job

Issei reported a problem with an unhealthy Typesense Cloud cluster. With the particular help of Jason and Kishore Nallan, they discovered that a problematic cron job was responsible. A solution, using a different endpoint for data export, was agreed on and implemented.

5

65
31mo
Solved