how i can select random 3 blogpost or other contents?
i am using liquid query.
A mitigation could be to list some ContentItemIds from a list of recent blog posts, then use the random operation in liquid to pick some of them, then render them.
But ideally SQL queries should allow for the random operator.
You can use LINQ too ..
You can use LINQ too ..
it's not possible to coding when you are using liquid query. i don't want to create new module. just i want to use end-user functionality
i am using liquid query.
I thought you 're using razor, but let me think about it ..
You can think all you want about it, or read this comment: https://github.com/OrchardCMS/OrchardCore/issues/3776#issuecomment-499623881
And this one https://github.com/OrchardCMS/OrchardCore/issues/3776#issuecomment-499624021
random operation in liquid
where i can find help about this operation?
A mitigation could be to list some ContentItemIds from a list of recent blog posts, then use the random operation in liquid to pick some of them, then render them.
Providing list off ContentItemIds is not good, because I remember all the content item ids or bring them from the database. It would be nice if there's a filter to takes Top(n) from within liquid
What if we clone index filter and create a new random filter that accept n.
{{ ContentItems | random: 3 }}
If this is useful I can make a prototype for it
No this is the solution
But ideally SQL queries should allow for the random operator.
Like in Orchard 1
If is that, may it need some addition in YesSQL, but we also may need to add some new array filters such as take in Fluid .. it's really useful
@hishamco I need to find you something more valuable to do ;)
any new news for this ability?
If you need a temp solution you can use LINQ as I mentioned above, or wait until this feature implemented out of the box
I require this functionality as well. How could this be achieved? Can I do something to help on this?
Should this only be possible for Sql queries or can the same be achieved for Lucene queries as well?
I think I have a solution for random sorting with Lucene queries. Can someone take a look at this commit?
https://github.com/OrchardCMS/OrchardCore/commit/ad798a58cdf339a82c24d161431996197208c09c