Sitecore XBlog按发布日期排序博客帖子(Sitecore XBlog get blog posts sort by Publish Date)

编程入门 行业动态 更新时间:2024-10-27 00:26:27
Sitecore XBlog按发布日期排序博客帖子(Sitecore XBlog get blog posts sort by Publish Date)

BlogManager方法的默认行为GetBlogPosts将返回按发布日期排序的所有帖子,在返回之前排序的代码如下所示。 但是我没有按发布日期(Blog Post模板的字段)排序结果。

var result = context.GetQueryable<SearchResultItem>().Where(predicate) .OrderByDescending(t => t[XBSettings.XBSearchPublishDate]) .Slice(startRowIndex, maximumRows) .CreateAs<BlogPost>().ToList();

我尝试通过将发布日期字段添加到索引配置来实现,但没有运气,需要帮助如何配置我根据博客文章模板的发布日期字段按降序获得结果。

Default behaviour of BlogManager method GetBlogPosts is to return all posts that are sorted by Publish Date, in code it sorts before returning as below. But I don't get results sorted by Publish Date (which is field of Blog Post template).

var result = context.GetQueryable<SearchResultItem>().Where(predicate) .OrderByDescending(t => t[XBSettings.XBSearchPublishDate]) .Slice(startRowIndex, maximumRows) .CreateAs<BlogPost>().ToList();

I tried to do it by adding Publish Date field to index config but no luck, need help how can I configure that I get results in descending order based on Publish Date field of Blog Post template.

最满意答案

查看索引并查看索引中“发布日期”字段的名称。 在某些情况下(使用solr时),我不得不将该值更改为“published_date_tdt”

Take a look at your index and see what the name of the Publish Date field is in the index. In some cases (when using solr), I have had to change that value to "published_date_tdt"

更多推荐

本文发布于:2023-08-07 15:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464722.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:发布日期   帖子   博客   XBlog   Sitecore

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!