【发布时间】:2011-07-27 19:44:08
【问题描述】:
我正在启动一个项目,我们正在尝试使用 Lucene .Net 索引 XML 文档的内容。在我发现的小文档中,索引似乎只能由具有单个字符串值的文件组成。我试图索引的数据比简单的键值对稍微复杂一些。
这是一个我想从中生成索引的 xml 文档示例:
<descriptor>
<asset guid="2AA7C8F9-2CB1-4A81-9421-C09F1D85939E" generated-date="2011-07-30" generated-by="hw/AutoMfg" generated-with="PMS">
<!-- information about where the asset can be used -->
<target>
<localization>en-us</localization>
<localization>es-us</localization>
<environment>desktop</environment>
<environment>mobile</environment>
</target>
<!-- all contents of an asset must have the same version -->
<version-information>
<version-number source="content">9.1.123.4</version-number>
<version-number source="manufacturing">9.1.123.4</version-number>
<release-label>9.1</release-label>
</version-information>
<!-- catalog information about the primary role of the asset -->
<role>
<namespace>parent.type.family.some.thing</namespace>
<mime-type>text/html</mime-type>
<hwid>abc1234</hwid>
</role>
</asset>
</descriptor>
所以我可以看到创建以“描述符”的子元素命名的字段,但是其中的子节点呢?如何索引这些数据?我应该创建一个分隔字符串来表示每个字段的值吗?
例如 field: "Target" Value:"localization: en-us;es-us environment: desktop;mobile | ...
我是否需要像上面的示例一样将数据展平以对其进行索引?
谢谢!
【问题讨论】:
标签: c# lucene full-text-search lucene.net