【发布时间】:2016-03-23 19:31:13
【问题描述】:
我需要一个非常具体的 Lucene 实现,它使用反序列化的 JSON 字符串存储多个“属性”字段。
例子:
Document:
ID: "99"
Text: "Lorepsum Ipsum"
Properties: "{
"lastModified": "1/2/2015",
"user": "johndoe",
"modifiedChars": 2,
"before": "text a",
"after": "text b",
}"
Properties:"{
"lastModified": "1/2/2013",
"user": "johncotton",
"modifiedChars": 6,
"before": "text aa",
"after": "text bbb",
}"
Properties: "{
"lastModified": "1/3/2015",
"user": "johnmajor",
"modifiedChars": 3,
"before": "text aa",
"after": "text b",
}"
我知道 ElasticSearch 和 Solr 具有在 JSON 对象中查找的实现,但我使用的是 Lucene 的核心 API (3.0.5)。
我的目标是使用 lucene 的 API 并添加一些实现来在 JSON 字符串中进行搜索,例如:
构建一种 BooleanQuery 类型,其中至少一个“属性”字段必须匹配查询中的所有值。 (例如查询“+user:tom +modifiedChars:3 +before:”text A”等)
我有一些想法,但我不知道从哪里开始。我要问的是实现这种实现的一些高级想法。自定义分析器可能与查询解析器一起使用? 将其视为一个开放式问题。欢迎所有建议。
【问题讨论】:
标签: lucene lucene.net