Hey, I am searching my collection. When I specify ...
# community-help
k
Hey, I am searching my collection. When I specify query_by as a comma separate list (
query_by=title,description,keywords
), I get the expected result, but when I separate them out (
query_by=title&query_by=description&query_by=keywords
), i get no results. I suspect it is related to the (
string[]
) field keyword, but can't figure out how to fix as the non-working query is the one that the python lib is calling
Copy code
https://${url}:443/collections/${collection-name}/documents/search?q=banana&query_by=title,description,keywords
//expected result

https://${url}:443/collections/${collection-name}/documents/search?q=banana&query_by=title&query_by=description&query_by=keywords
//no results
j
Oh hmm, query by needs to be a single comma separated parameter. Could you share the Python script you’re using that generates the duplicate parameter?
k
Copy code
search_parameters = {
    'q': 'python',
    'query_by': ['title', 'description', 'keywords']
}

res = client.collections[COLLECTION_NAME].documents.search(search_parameters)
j
Ah you want to join query by array with a comma
k
so just
'query_by': ['title', 'description', 'keywords']
->
'query_by': 'title,description,keywords'
(or
'query_by': ','.join(['title', 'description', 'keywords'])
Seems to be working. Thanks!
👍 1