【发布时间】:2010-11-20 07:35:12
【问题描述】:
我正在测试 Lucene.NET 以满足我们的搜索要求,我有几个问题。
我们有 XML 格式的文档。每个文档都包含多语言文本。语言的数量和语言本身因文档而异。请参见下面的示例:
<document>This is a sample document, which is describing a <word lang="de">tisch</word>, a <word lang="en">table</word> and a <word lang="en">desk</word>.</document>
文档的关键字用特殊元素和语言属性标记。
当我创建 lucene 索引时,我从 XML 以及语言和关键字对中提取文本内容(我不确定是否必须这样做),如下所示:
This is a sample document, which is describing a tisch, a table and a desk.
de - tisch
en - table
en - desk
我不知道如何创建一个可以搜索的索引,例如: - 所有在德语中包含单词 tisch 的文档(而不是在其他语言中包含单词 tisch 的文档)。
而且我还想在运行时指定排序: 我想按用户指定的语言顺序排序(取决于用户界面)。例如,如果我们有两个文档:
<document>This is a sample document, which is describing a <word lang="de">tisch</word>.</document>
<document>This is a another sample document, which is describing a <word lang="en">table</word>.</document>
英文界面上的用户通过“tisch OR table”搜索我想先得到第二个结果。
感谢任何信息或建议。
非常感谢!
【问题讨论】:
标签: indexing lucene lucene.net multilingual