it is working fine from curl, but not from Laravel...
# community-help
s
it is working fine from curl, but not from Laravel's
scout.php
f
So after querying
/collections/<name>
you don't get the token separators back?
s
correct. the key is there, but it is set to
[]
{
"created_at": 1734279401,
"default_sorting_field": "",
"enable_nested_fields": false,
"fields": [
...
],
"name": "components",
"num_documents": 53674,
"symbols_to_index": [],
"token_separators": []
}
while the schema in
scout.php
looks like this:
'collection-schema' => [
'name' => 'components',
"token_separators" => [".", ",", ":", "(", ")"],
'default_sorting_field' => 'created_at',
'fields' => [
...
],
],
'search-parameters' => [
'query_by' => 'name'
],
]
f
Huh. This worked as expected.
Copy code
Collection::class => [
                "collection-schema" => [
                    "fields" => [
                        [
                            "name" => "name",
                            "type" => "string",
                        ],
                        [
                            "name" => "price",
                            "facet" => true,
                            "type" => "float",
                        ],
                        [
                            "name" => "hltb_single",
                            "type" => "int32",
                            "facet" => true,
                            "optional" => true,
                        ],
                        [
                            "name" => "positive",
                            "facet" => true,
                            "type" => "int32",
                        ],
                        [
                            "name" => "negative",
                            "facet" => true,
                            "type" => "int32",
                        ],
                        [
                            "name" => "app_id",
                            "type" => "string",
                        ],
                        [
                            "name" => "min_owners",
                            "type" => "int32",
                        ],
                        [
                            "name" => "max_owners",
                            "type" => "int32",
                        ],
                        [
                            "name" => "created_at",
                            "type" => "int64",
                        ],
                        [
                            "name" => "release_date",
                            "type" => "int64",
                        ],
                    ],
                    "default_sorting_field" => "release_date",
                    "token_separators" => ["&", "|"],
                ],
                "search-parameters" => [
                    "query_by" => "name, app_id",
                ],
            ],
what typesense server version are you using?
s
27.1
it's the latest docker image, so my server is running in a container, which is different from the container in which my Laravel server is running. That shouldn't matter though.
f
It would only matter if it couldn't reach the Typesense instance, but it does. Could you confirm the issue persists when having it set as the last parameter inside the
collection-schema
map?
s
it was actually the 2nd-last element originally and wasn't working, then i saw an example in the official docs, where it was near the top, so i moved it up just to make sure. Didn't work in either case. But let me try with making it the last one.
works; finally!
it was not related to the position of
token_separators
key. Problem was that Laravel queued job that updates typesense index reads the scout config file only upon startup. Once the job is running, changing the config, or caching/clearing it doesn't affect the job in any way and it keeps using the config it loaded initially. I killed the job and started a new one and it started behaving correctly.
thanks for the input. appreciated.
🙌 1
f
Happy you found that solution!
👍 1