创建 lucene 索引以根据子级数据查找父级

发布于 2024-12-27 06:06:51 字数 269 浏览 2 评论 0原文

我试图了解如何为具有一对多关系的数据构建 lucene 索引。

假设我有一张包含 id 和姓氏的家庭表 以及一个包含 ID、名字和爱好的人员表(这是自由文本)。

我将如何创建一个 lucene 索引来帮助我找到家庭成员的爱好与搜索查询(作为全文搜索)相匹配的家庭?

我只想让每个匹配的家庭一次(即使有几个家庭成员的爱好是查询的热门。

如果我在家庭上也有一个爱好字段,请自行记录(除了个人爱好之外)并且我想要获得与家庭爱好或某个家庭成员的爱好相匹配的所有家庭吗?

I am trying to understand how to build a lucene index for data that has a 1 to many relation.

suppose I have a table for families with id and family name
and a table of people with id, first name, and hobbies (which is free text).

how would I create a lucene index that will help me find families that have family members that their hobbies match the search query (as full text search) ?

I want to get each matching family just once (even if there are several family members that their hobbies are a hit for the query.

What If I also had a hobbies field on the family record it self (in addition to personal hobbies) and I wanted to get all the families that either match on the family hobby or on the hobby of on of the family members ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╄→承喏 2025-01-03 06:06:51

您可以将家庭视为由爱好(术语)组成的文件。索引可搜索领域的爱好,无论是家庭爱好还是个人爱好。对于其余字段,只需将它们存储为附加字段即可。

You may treat families as documents that are composed of hobbies (terms). Index hobbies in a searchable field, no matter they are family hobbies or personal hobbies. For the rest of the fields just store them as additional fields.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文