【发布时间】:2010-04-29 09:20:33
【问题描述】:
基本上,我确实有非常简单的数据库,我想用 Lucene 编制索引。 域是:
// Person domain
class Person {
Set<Pair> keys;
}
// Pair domain
class Pair {
KeyItem keyItem;
String value;
}
// KeyItem domain, name is unique field within the DB (!!)
class KeyItem{
String name;
}
我有几千万个配置文件和几亿个Pairs,但是,由于大部分KeyItem的“名称”字段重复,所以只有几十个KeyItem实例。 想出了那个结构来保存 KeyItem 实例。
基本上,任何包含任何字段的配置文件都可以保存到该结构中。 假设我们有属性的配置文件
- name: Andrew Morton
- eduction: University of New South Wales,
- country: Australia,
- occupation: Linux programmer.
为了存储它,我们将有一个 Profile 实例、4 个 KeyItem 实例:姓名、教育、国家和职业,以及 4 个具有值的 Pair 实例:“Andrew Morton”、“University of New South Wales”、“Australia”和“Linux 程序员”。
所有其他个人资料将引用(全部或部分)相同的 KeyItem 实例:姓名、教育、国家和职业。
我的问题是,如何索引所有这些,以便我可以在 Profile 中搜索 KeyItem::name 和 Pair::value 的某些特定值。理想情况下,我希望这种查询能够工作:
姓名:Andrew* AND 职业:Linux*
我应该创建自定义索引器和搜索器吗?或者我可以使用标准的并以某种方式将 KeyItem 和 Pair 映射为 Lucene 组件?
【问题讨论】:
标签: lucene compass-lucene