Random item from Algolia

Viewed 58

How do I get random algolia item from it's index?

All of my items have:

objectID "POST#news#44.7704046#17.1900285"

name "News"

categories [ "cafe", "food", "establishment", "food" ]

_geoloc { lat: "44.7704046", lng: "17.1900285" }

I would like to optionally search by name, match 1 or all categories, geo location filtering with distance, and most importantly, I only want 1 RANDOM returned from Algolia.

I can't do client side random, because sometimes without filters I would get too many results back ( 10000 ), so I can't transfer that over the wire.

Please help

1 Answers

Hi @Djordje there are no real way to get a random result with Algolia though you you could use an attribute to randomise the results and only use the first item. See documentation [here][1]

Related