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"
更多推荐
发布评论