加Search功能
有几个要点
1. 需要在Kooboo 必须先 ReBuild Index Data
2. 需要在要搜索的page中启用搜索索引
搜索的代码
@
using
Kooboo.CMS.Content.Models
@
using
Kooboo.CMS.Search
@{ var result = Repository.Current.Search(
"Dolor"
, 1, 10); }
@result.TotalItemCount
@
foreach
(var item
in
result)
{
<p>@item.Title @item.HighlightedTitle</p>
<p>@item.HighlightedBody</p>
}
Did you have add the search index setting, the search index setting must to add to enable the content indexing.
时间: 2024-10-09 17:05:21