In Solr, Whats the best approach to order results by random?, basically needs to pick some records at random.
Use a RandomSortField. There's an example in the bundled schema.xml in example directory (under solr
):
Sort your result list by the field random_
, where you replace
with a randomly generated value (but use the same value if you're paginating through the result, as it will give you a stable sort based on the field name).