【发布时间】:2023-03-24 18:43:01
【问题描述】:
我是 lucene 的初学者。现在我因为搜索问题被屏蔽了。我们正在开发一个 API 来使用 lucene 作为我们应用程序的搜索引擎,并且必须在加入时使用不同的条件进行大量查询。
我们将许多实体作为单独的文档存储到 lucene 中。
每个实体都以记录数的形式出现,并作为单独的文档存储到 lucene 中。在下面添加了一个示例数据结构,
序列号1 --> 16 是 lucene 的文档。
1) "id": "1","sendr_name": "**sender1**", "recip_name": "**recipient1**", "subject": "**subject1**"
2) "id": "1","attachment": "**attachment1**"
3) "id": "1","domain": "**domain1**", "ip": "ip1"
5) "id": "1","mid": "**mid1**"
6) "id": "1","type": "type1"
7) "id": "2","sendr_name": "sender1", "recip_name": "recipient1", "subject": "subject1"
8) "id": "2","attachment": "attachment2"
9) "id": "2","domain": "domain1", "ip": "ip2"
10) "id": "2","mid": "mid2"
11) "id": "2","type": "type2"
12) "id": "3","sendr_name": "sender1", "recip_name": "recipient3", "subject": "subject3"
13) "id": "3","attachment": "attachment3"
14) "id": "3","domain": "domain1", "ip": "ip3"
15) "id": "3","mid": "mid3"
16) "id": "3","type": "type3"
注意:序列号1-16是不同实体的文档,字段“id”是内部生成的,所以id值不能被用户用作查询值。
我的需要是在特定条件下提取特定实体或实体。
+sendr_name:sender1 + recip_name:recipient1 +subject:subject1 +attachment:attachment1 +domain:domain1 +mid:mid1
这是为了获取实体信息(一个实体的 1-6 个文档)。
但上述查询无法返回结果,因为附件、中间和域在不同的文档中。
有什么方法可以将 AND 条件扩展到多个文档?或者无论如何我们可以在像 doc1.id = doc2.id 这样的字段上加入查询?
我请求大家提供您的建议或帮助解决这个问题。
【问题讨论】:
-
有人可以帮忙吗?
-
你使用的是 elasticsearch 还是 raw Lucene API?
-
我只使用原始 Lucene API。