zl程序教程

您现在的位置是:首页 >  其它

当前栏目

Kooboo 加Search功能 必须先ReBuild Index Data

功能 Data 必须 index search
2023-09-11 14:21:33 时间
 
加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.