Sitecore TreelistEx search with Lucene.NET
有没有办法使用 Lucene.NET 在 Sitecore 内部的自定义索引中搜索 TreeListEx 字段的内容?我尝试使用 WildQuery 来确定某个项目是否是 TreeListEx 字段的一部分,但它不起作用。下面是我尝试过的代码示例 -
1 | WildcardQuery taggingQuery = new WildcardQuery(new Term("country tag", ShortID.Encode("{4ED2F7EE-5C2A-418C-B2F6-236F94166BA1}").ToLowerInvariant())); |
我基本上是在尝试做一个"包含",而 WildCardQuery 是我能想到的唯一方法。
我应该在设置索引时多加注意。我忘了为每个字段添加字段分析器。使用不同的分析器而不是标准分析器对多列表字段进行索引。我将此添加到我的配置部分以进行字段抓取,并且我的查询开始工作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <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> |