I'm running into an issue with this Algolia/Instan...
# community-help
e
I'm running into an issue with this Algolia/InstantSearch to Typesense adaptation. I have a Typesense field setup like this:
Copy code
[
    'name' => 'attributes\.*',
    'type' => 'auto',
    'optional' => true,
    'facet' => true
]
This seems to work fine. It indexes all the flattened attribute fields with dot-notation. The issue is that not every document has all the attribute fields, which makes the InstantSearch fail.
Copy code
Error: 404 - Could not find a facet field named `attributes.operating-system` in the schema.
Is this a bug in the InstantSearch adapter, or am I doing something wrong?
j
Could you GET the collection and double check that that attribute shows up in the schema?
You need to have at least one document with that field before being able to use it in instantsearch, or it has to be explicitly defined in the collection schema
e
it's an "auto" type attribute defined as stated above.
message has been deleted
and there are definitely documents with that attribute
message has been deleted
k
There is a typo in the name in the schema. It should be
attributes\..*
Likewise for product_category as well:
product_category\..*
e
oh, ok! an extra dot. thank you, I will try this!
but why this extra dot? just trying to understand
k
What we want is to match any field that begins with
attributes.
-- since the dot is a special character in regexp, we have to use a backslash to escape it, like this
\.
. Then we want to match any number of characters after that, so we use
.*
-- putting those two together:
attributes\..*
If will be easier on the eyes if you used underscore as a separator, then it will just be
attributes_.*
e
oh yea, of course, I get it now! thank you for the great support! and it worked! Algolia OUT -> Typesense IN 🙂
k
🎉 happy to help