类 CmsSearchDirective
java.lang.Object
com.publiccms.common.directive.BaseTemplateDirective
com.publiccms.common.base.AbstractTemplateDirective
com.publiccms.views.directive.cms.CmsSearchDirective
- 所有已实现的接口:
Directive,HttpDirective,freemarker.template.TemplateDirectiveModel,freemarker.template.TemplateModel
- 直接已知子类:
CmsFacetSearchDirective
search 内容列表查询指令
上下文变量
lang:语言
参数列表
word:搜索词,多个搜索词时取并集结果exclude:排除词汇tagIds:多个标签id,多个标签时取并集结果userId:用户idparentId:父内容idcategoryId:分类idcontainChild:包含子分类,当categoryId不为空时有效categoryIds:多个分类id,当categoryId为空时有效modelIds:多个模型idextendsValues多个全文搜索字段値,格式:[字段编码]:字段値],例如:extendsValues='isbn:value1,unicode:value2'dictionaryValues多个字典搜索字段値,只有数据字典父级値時包含所有子级结果,格式:[字段编码]_[字段値],例如:dictionaryValues='extend1_value1,extend1_value2'dictionaryUnion取数据字典并集结果,dictionaryUnion不为空时有效,【true,false】,默认为交集结果highlight:高亮关键词,【true,false】,默认为false,启用高亮后, 标题、作者、编辑、描述字段应该加?no_esc以使高亮html生效,cms会自动对原值有进行html安全转义preTag:高亮前缀,启用高亮时有效,默认为"<B>"postTag:高亮后缀,启用高亮时有效,默认为"</B>"projection:投影结果,【true,false】,默认为falsephrase:精确搜索,【true,false】,默认为falsefields:搜索字段,【title:标题, author:作者, editor:编辑, description:描述, text:正文,files:附件】containsAttribute默认为false,http请求时为高级选项,为true时content.attribute为内容扩展数据map(字段编码,value)startPublishDate:起始发布日期,【2000-01-01 23:59:59】,【2000-01-01】endPublishDate:终止发布日期,【2000-01-01 23:59:59】,【2000-01-01】orderField排序字段,【clicks:点击数倒序,score:分数倒序,publishDate:发布日期倒序,collections:收藏数倒叙,minPrice:最低价格,maxPrice:最高价格,extend.sort1-extend.sort10]:扩展字段排序标志】,默认相关度倒序pageIndex:页码pageSize:每页条数maxResults:最大结果数
返回结果
page:PageHandlerpage.list:List类型 查询结果实体列表CmsContent
<#assign lang="cn"/> <@cms.search word='cms' pageSize=10><#list page.list as a>${a.title}<#sep>,</#list></@cms.search>
<script>
fetch('${site.dynamicPath}api/directive/cms/search?word=cms&pageSize=10',{"headers":{"lang":"cn"}}).then(res => res.json()).then(data=>{
console.log(data.page.totalCount);
});
</script>
-
字段概要
字段修饰符和类型字段说明private CmsContentAttributeServiceprotected ContentConfigComponentprotected FileUploadComponentprivate CmsContentLangServiceprivate CmsContentServiceprotected SiteAttributeComponentprivate StatisticsComponent从类继承的字段 com.publiccms.common.base.AbstractTemplateDirective
ADVANCED, APP_TOKEN, AUTH_TOKEN, AUTH_USER_ID, siteComponent从类继承的字段 com.publiccms.common.directive.BaseTemplateDirective
log从接口继承的字段 freemarker.template.TemplateModel
NOTHING -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidexecute(RenderHandler handler) query(RenderHandler handler, boolean factSearch) boolean从类继承的方法 com.publiccms.common.base.AbstractTemplateDirective
execute, expose, getAdvanced, getApp, getSite, getUser, getUserId, needAppToken, needUserToken从类继承的方法 com.publiccms.common.directive.BaseTemplateDirective
execute, getName, getNamespace, getShortName, httpEnabled, setName, setNamespace, setShortName
-
字段详细资料
-
attributeService
-
statisticsComponent
-
contentConfigComponent
-
siteAttributeComponent
-
fileUploadComponent
-
service
-
langService
-
-
构造器详细资料
-
CmsSearchDirective
public CmsSearchDirective()
-
-
方法详细资料
-
execute
public void execute(RenderHandler handler) throws IOException, freemarker.template.TemplateException - 参数:
handler-- 抛出:
IOExceptionfreemarker.template.TemplateException
-
query
public PageHandler query(RenderHandler handler, boolean factSearch) throws freemarker.template.TemplateModelException - 抛出:
freemarker.template.TemplateModelException
-
supportAdvanced
public boolean supportAdvanced()- 覆盖:
supportAdvanced在类中AbstractTemplateDirective- 返回:
- support advanced parameters
-