如何设置Umbraco搜索,使特定节点不被包含在搜索结果中?
- 内容介绍
- 文章标签
- 相关推荐
本文共计302个文字,预计阅读时间需要2分钟。
我已经创建了Umbraco搜索,其中我希望排除一些不应该被搜索的点。因此,我需要在搜索条件中定义或检查配置文件的设置,或在一些代码中进行一些操作。例如,设置索引集和名称为De。
我已经创建了umbraco搜索,其中我想要一些不应该被搜索的节点,所以我可以做的是我应该在搜索条件中定义或sholud我在检查配置文件的设置或索引设置代码中做一些事情<IndexSet SetName="DemoIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/DemoIndex/"> <IndexAttributeFields/> <IndexUserFields/> <IncludeNodeTypes/> <ExcludeNodeTypes> <add Name="News" /> </ExcludeNodeTypes> </IndexSet>
并检查设置文件
<add name="DemoIndexer" type="UmbracoExamine.LuceneExamineIndexer, UmbracoExamine" runAsync="true" supportUnpublished="false" supportProtected="true" interval="10" analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net" indexSet="DemoIndexSet"/>
和用户控制代码是
public static class SearchResultExtensions { public static string FullUrl(this SearchResult sr) { return umbraco.library.NiceUrl(sr.Id); } } SearchTerm = Request.QueryString["s"]; if (string.IsNullOrEmpty(SearchTerm)) return; SearchResults = ExamineManager.Instance.SearchProviderCollection["DemoSearcher"].Search(SearchTerm,true).ToList(); SearchResultListing.DataSource = SearchResults; SearchResultListing.DataBind(); 如果要排除节点类型,只需将其放在IndexSet标记之间
<IndexSet ...> ... <ExcludeNodeTypes> <add Name="NameNodeType" /> </ExcludeNodeTypes> </IndexSet>
有关codeplex examine的更多信息
本文共计302个文字,预计阅读时间需要2分钟。
我已经创建了Umbraco搜索,其中我希望排除一些不应该被搜索的点。因此,我需要在搜索条件中定义或检查配置文件的设置,或在一些代码中进行一些操作。例如,设置索引集和名称为De。
我已经创建了umbraco搜索,其中我想要一些不应该被搜索的节点,所以我可以做的是我应该在搜索条件中定义或sholud我在检查配置文件的设置或索引设置代码中做一些事情<IndexSet SetName="DemoIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/DemoIndex/"> <IndexAttributeFields/> <IndexUserFields/> <IncludeNodeTypes/> <ExcludeNodeTypes> <add Name="News" /> </ExcludeNodeTypes> </IndexSet>
并检查设置文件
<add name="DemoIndexer" type="UmbracoExamine.LuceneExamineIndexer, UmbracoExamine" runAsync="true" supportUnpublished="false" supportProtected="true" interval="10" analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net" indexSet="DemoIndexSet"/>
和用户控制代码是
public static class SearchResultExtensions { public static string FullUrl(this SearchResult sr) { return umbraco.library.NiceUrl(sr.Id); } } SearchTerm = Request.QueryString["s"]; if (string.IsNullOrEmpty(SearchTerm)) return; SearchResults = ExamineManager.Instance.SearchProviderCollection["DemoSearcher"].Search(SearchTerm,true).ToList(); SearchResultListing.DataSource = SearchResults; SearchResultListing.DataBind(); 如果要排除节点类型,只需将其放在IndexSet标记之间
<IndexSet ...> ... <ExcludeNodeTypes> <add Name="NameNodeType" /> </ExcludeNodeTypes> </IndexSet>
有关codeplex examine的更多信息

