Paul Barry
09/19/2024, 7:53 PMclient.collections["users"].documents.search(
q: "Paul",
query_by: "name",
sort_by: "location(38.879140, -76.981880):asc:asc"
)
I get this error:
ETHON: performed EASY effective_url=<http://localhost:8108/collections/users/documents/search?q=Paul&query_by=name&sort_by=location%2838.879140%2C%20-76.981880%29%3Aasc%3Aasc> response_code=404 return_code=ok total_time=0.004434
/Users/paul/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/typesense-2.0.0/lib/typesense/api_call.rb:100:in `block in perform_request': Could not find a field named `location(38.879140, -76.981880):asc` in the schema for sorting. (Typesense::Error::ObjectNotFound)
But when I look a the schema:
puts JSON.pretty_generate(client.collections["users"].retrieve)
{
"created_at": 1726775082,
"default_sorting_field": "",
"enable_nested_fields": false,
"fields": [
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "name",
"optional": false,
"sort": false,
"stem": false,
"store": true,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "location",
"optional": true,
"sort": true,
"stem": false,
"store": true,
"type": "geopoint"
}
],
"name": "users",
"num_documents": 222801,
"symbols_to_index": [],
"token_separators": []
}
It looks like I have a field named location that is a geopoint and has sort set to true. Does anyone know why this doesn't work?