Select n items of a ContentType in OrchardCore randomly using lucene

94 Views Asked by At

I need to select n items of a ContentType in OrchardCore randomly using query DSL but every time it returns the same result. Actually I think that it is not a correct approach. Here is the query DSL code:

{
  "query": {
    "term": { "Content.ContentItem.ContentType": "Product" }
  },
  "sort": [
    { "Content.ContentItem.CreatedUtc": { "order": "random" } }
  ],
  "size": 3
}

Actually I followed this link https://github.com/OrchardCMS/OrchardCore/issues/6916#issuecomment-674504976

0

There are 0 best solutions below