【问题标题】:How to index Multilist with lucene如何使用 lucene 索引多列表
【发布时间】:2014-03-05 12:42:40
【问题描述】:

在我们的模板中,我们定义了一个 Multilist 字段。我们将此字段添加到 Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config 文件中:

<field fieldName="apps_or"                storageType="YES"  indexType="TOKENIZED"    vectorType="NO" boost="1f" type="System.GUID" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">

当它在此文件中显示&lt;IndexAllFields&gt;true&lt;/IndexAllFields&gt; 时,为什么有必要这样做?

添加此行并发布所有内容后,我们会看到该字段出现在 Luke 工具的概览选项卡中。但在“文档”选项卡中,该字段仍然缺失。此外,当我们使用 .Net 在网络索引上进行内容搜索时,该字段始终为空:

class NewsSearchResultItem : SearchResultItem
{
    public string Title { get; set; }
    public string Body { get; set; }
    public string Introduction { get; set; }

    [IndexField("apps_or")]
    public IEnumerable<ID> AppIdOr { get; set; }

}

apps_or 是出现在 Luke 工具中的索引名称。任何想法如何正确获取索引中的字段并通过 .Net 提供它??

非常感谢提前 罗伯特

【问题讨论】:

  • 你可以尝试使用 List 而不是 IEnumerable,我不是 100% 确定它会起作用,我记得我之前看到过这个问题...
  • 不幸的是,同样的行为。当类型错误时,人们会期待异常吗?搜索后是否有可能包含此类信息的日志文件?
  • 您描述的行为是Lucene中索引但未存储的字段的典型行为。不过,我对 Sitecore 的了解还不够,无法看到您所拥有的任何问题。 storageType="YES" 听起来对我来说是正确的,但它似乎仍然没有被存储。希望这能为您指明正确的方向。

标签: .net lucene sitecore sitecore7


【解决方案1】:

你是对的femtoRgon!它被索引但没有被存储,显然你必须在同一个配置文件中启用存储多列表字段:

<fieldType fieldTypeName="multilist"                          storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String"   settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />

【讨论】:

    猜你喜欢
    • 2012-11-20
    • 1970-01-01
    • 2010-09-20
    • 1970-01-01
    • 1970-01-01
    • 2011-02-06
    • 1970-01-01
    • 1970-01-01
    • 2012-03-08
    相关资源
    最近更新 更多