#community-help

Solving Bool Field Filtering Issue in Typesense

TLDR Guillermo was struggling with filtering by a bool field in Typesense. Jason assisted, and realized that Guillermo forgot to add the relevant field in the firebase-typesense extension configuration.

Powered by Struct AI

2

1

18
9mo
Solved
Join the chat
Jan 18, 2023 (9 months ago)
Guillermo
Photo of md5-6f48d9114b22b98994ccbbd9192d9718
Guillermo
07:06 PM
Hello! is this the correct way of filtering by a bool field? its not working
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:07 PM
Could you post the output of that method?
07:08
Jason
07:08 PM
what gets finally stored in searchParameters and gets passed to the Typesense client?
Guillermo
Photo of md5-6f48d9114b22b98994ccbbd9192d9718
Guillermo
07:08 PM
this is the schema, I was wondering that maybe its because its optional

    {
      "facet": true,
      "index": true,
      "infix": false,
      "locale": "",
      "name": "isFeatured",
      "optional": true,
      "sort": false,
      "type": "bool"
    },
07:10
Guillermo
07:10 PM
this is the output:
{q: *, query_by: name, filter_by: isFeatured: true, sort_by: geolocation(-34.6213324,-58.3796079):asc, per_page: 10, page: 1}
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:11 PM
This should work… Just to be sure, could you check if isFeatured:true works? (No space before true)
07:12
Jason
07:12 PM
Also, when you say “it’s not working”, in the results that are returned, do you see documents with isFeatured with all types of values?
Guillermo
Photo of md5-6f48d9114b22b98994ccbbd9192d9718
Guillermo
07:13 PM
It looks like the documents are not indexing with the ‘isFeatured’ field so its probably a problem with the schema definition
07:13
Guillermo
07:13 PM
I get no results
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:14 PM
When you remove that filter, do you get results with documents where isFeatured:true?
Guillermo
Photo of md5-6f48d9114b22b98994ccbbd9192d9718
Guillermo
07:16 PM
Well yes, but the documents dont appear to have that field when saving in Typesense
07:16
Guillermo
07:16 PM
Im 100% sure that specific document has that isFeatured field
07:16
Guillermo
07:16 PM
in Firebase
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:17 PM
Wondering if it’s a UI issue… Could you open the browser’s dev console, open the network tab, then do a search in the UI, then look for a network request to “multi_search”. Could you look at the results of that API call, and expand results -> hits -> document and check if the field shows up there?
07:18
Jason
07:18 PM
If you can share your cluster ID I can take a quick look as well
Guillermo
Photo of md5-6f48d9114b22b98994ccbbd9192d9718
Guillermo
07:21 PM
The field does not show up there, let me re-sync the firebase-typesense extension

1

07:22
Guillermo
07:22 PM
No luck re-syncing, I sent you privately the cluster ID
07:27
Guillermo
07:27 PM
SOLVED! thank you Jason .
The problem was that I forgot to add that field in the configuration of the firebase-typesense extension 😅

1

1