有没有办法使用Lucene.NET在Sitecore内的自定义索引中搜索TreeListEx字段的内容?我试图使用WildQuery来确定一个项是否是TreeListEx字段的一部分,但它不起作用。下面是我尝试的代码示例 -
WildcardQuery taggingQuery = new WildcardQuery(new Term("country tag", ShortID.Encode("{4ED2F7EE-5C2A-418C-B2F6-236F94166BA1}").ToLowerInvariant()));
我基本上试图做一个“包含”,而WildCardQuery是我能做到的唯一方法。
答案 0 :(得分:2)
设置索引时我应该多加注意。我忘了为每个领域添加现场分析仪。多列表字段使用不同的分析器而不是标准分析器进行索引。我将此添加到我的配置部分以进行字段抓取并且我的查询已开始工作
<fieldTypes hint="raw:AddFieldTypes">
<!-- Text fields need to be tokenized -->
<fieldType name="single-line text" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="multi-line text" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="word document" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="html" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="rich text" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="memo" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="text" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<!-- Multilist based fields need to be tokenized to support search of multiple values -->
<fieldType name="multilist" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="treelist" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="treelistex" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<fieldType name="checklist" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
<!-- Legacy tree list field from ver. 5.3 -->
<fieldType name="tree list" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />
</fieldTypes>