Kentico CMS 搜索结果

发布于 2024-08-28 06:12:14 字数 144 浏览 7 评论 0原文

如何更改 Kentico CMS 搜索设置以便显示搜索结果中的部分文本就像在谷歌一样?目前它仅显示结果中的路径。

How do I change the Kentico CMS search settings so as to display a part of text from search results as in Google? Presently it shows only the path in the results.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

那请放手 2024-09-04 06:12:14

这取决于您的搜索设置。

在页面级别,如果您使用现在大多数人使用的Portal Engine模型,您必须检查您正在使用的Widget,基本上它可以归结为常规搜索或智能搜索。

如果您使用 ASPX 模板模型,您可能必须打开页面源代码,并从 ~/CMSWebParts/Search/ 或 ~/CMSWebParts/SmartSearch/ 查看

您使用的用户控件文件。检查它使用的转换的问题。您很可能会使用以下其中一项:

CMS.Root.SearchResults
CMS.Root.SmartSearchResults
CMS.Root.SmartSearchResultsWithImages

单击“编辑转换”并检查哪个字段位于对 SearchHighlight 的调用中,通常是“内容”。然后您就知道它是从文档的主要内容中提取的。我还看到这与“标题”或“说明文字”等不同字段相关。但默认是“内容”。

如果您仍然看不到部分文本的结果,请确保您有智能搜索索引设置,可在 CMSSiteManager -> 中找到。管理->智能搜索。如果您在索引列表中没有看到您的网站,则需要添加一个。确保重建并优化它(单击该行上的编辑以访问这些选项)。全部重建完成后,您应该会看到文本出现在结果下方。

It depends on how you have your search setup really.

At the page level if you are using the Portal Engine model, which the majority of people use now, you have to check the Widget that you are using, basically it boils down to a regular search or Smart Search.

If your using the ASPX Template model you may have to open up your source for the page and see which usercontrol file your using from ~/CMSWebParts/Search/ or ~/CMSWebParts/SmartSearch/

Once you figure out which user control you are using it's a matter of inspecting the Transformation that it uses. Most likely you'll be using one of the following:

CMS.Root.SearchResults
CMS.Root.SmartSearchResults
CMS.Root.SmartSearchResultsWithImages

Click on Edit Transformation and check out which field is inside the Call to SearchHighlight, normally, "Content". Then you know it's pulling from the main content of the document. I've also seen this be tied to a different field like "Title" or "Caption". But the default is "Content".

If you still dont see results with part of the text, make sure you have a Smart Search Index setup, found in CMSSiteManager -> Administation -> Smart Search. If you don't see your site in the Index list then you need to add one. Make sure you rebuild it and optimize it (click edit on the row to get to those options). After that is all rebuilt then you should see the text appear under the result.

数理化全能战士 2024-09-04 06:12:14

需要注意的一件事是,正如 @jao 所提到的,这只需要页面内容的前 280 个字符。如果您匹配的搜索文本恰好不在前 280 个字符内,则不会突出显示。

One thing to note, is that as @jao has mentioned, this only takes the first 280 characters of the content of the page. If you're matching search text doesn't happen to be in the first 280 characters, then no highlighting will occur.

中性美 2024-09-04 06:12:14

在搜索结果转换中尝试以下操作:

<p>
<%# SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"),"")),false, " ")), 280, "...")),"<span style=\"background-color: #FEFF8F\">","</span>") %>
</p>

这将显示内容中的前 280 个字符,并突出显示搜索词。

try the following in your search result transformation:

<p>
<%# SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"),"")),false, " ")), 280, "...")),"<span style=\"background-color: #FEFF8F\">","</span>") %>
</p>

This will show the first 280 characters from your content, with the search terms highlighted.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文