is a random integer on the document still "the way...
# community-help
e
is a random integer on the document still "the way to go" to fetch random documents? - no "random" sorting or better workaround?
j
Yup, that's still the way to go
@em1nos Out of curiosity, may I know what your use case is, to fetch random documents?
e
@Jason Bosco I have an ecommerce type site (product/price comparison) with different product categories. On the homepage I'm displaying a 6 product grid (+ swiper to load more) of "random popular products from some category below this price, or with these features". There are a few reasons why I'd like to use Typesense to fetch these products and not the database. Mostly easy advanced filtering on attributes etc. Would it be possible to add a "random" sort order to Typesense?
The random integer field solution feels super awkward to me so I'm just loading 250 products sorted by popularity and then limiting the number of products to smaller number before displaying the grid.
It works for me in this case because I need "the most popular ones" anyway in most cases.
j
Could you open a Github issue describing this use case? We've had asks for this in passing, but not one that's documented yet in an issue.