#community-help

Querying Fields in Random Order in a Collection with Typesense

TLDR Andrew asked if it was possible to query fields in a random order with Typesense. Jason explained that this feature isn't currently available but is being tracked within a GitHub issue and provided a workaround.

Powered by Struct AI
5
12mo
Solved
Join the chat
Oct 19, 2022 (12 months ago)
Andrew
Photo of md5-7766f890de99fa72a6d81315691a6758
Andrew
03:55 PM
And finally, is there a way to query fields in a random order?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:56 PM
Didn’t get you… Could you give me an example?
Andrew
Photo of md5-7766f890de99fa72a6d81315691a6758
Andrew
04:09 PM
Example: a collection has 100 docs. On one query, 10 random documents of no particular order are returned. The next query, a different random 10 are returned.

Does that clarify it better?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:11 PM
Ah, that’s not possible out of the box in Typesense. We’re tracking this feature request in: https://github.com/typesense/typesense/issues/637

Could you add a comment to that issue with your use case?

In the meantime, let me post a workaround in that issue shortly, so it’s documented for future users.