如何从关联中索引属性?

发布于 2024-10-03 01:26:30 字数 265 浏览 9 评论 0原文

当我在应用程序中索引对象时(使用 hibernate 搜索和 lucene),我想在索引中存储对象关联的一些属性。我需要将它们存储在索引中,因为我需要快速检索这些属性。执行此操作的最佳方法是什么?

  1. 将对象关系存储在lucene中。这似乎是最简单、最快的方法。
  2. 将对象关系存储在数据库中将
  3. 对象关系存储在单独的东西中,例如快速键值存储

对于如何存储应用程序对象图中的对象子集的一组属性还有其他想法吗?我应该使用哪种解决方案?

When I'm indexing objects in my application (using hibernate search and lucene) I would like to store in the index some of the attributes of the object's associations. I need to store them in the index because I need a fast retrieval of those attributes. What is the best approach for doing this?

  1. Store the object relationships in lucene. This seems like the easiest and fastest approach.
  2. Store the object relationships in db
  3. Store the object relationships in something separate like a fast key-value store

Any other ideas on how I can store a set of attributes from a subset of objects from my app's object graph? Which solution should I use?

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

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

发布评论

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

评论(1

潇烟暮雨 2024-10-10 01:26:30

如果您在检索文档时经常需要这些属性,我会将它们放在索引中。如果它们的使用不频繁,我会使用选项 2 或 3。如果您知道何时需要它们,何时不需要它们,则可以使用 FieldSelector 控制是否加载(或加载哪些)属性。

另一个需要考虑的因素是属性的基数以及您是否可以考虑将它们的值合并到查询或排名算法中。如果答案是肯定的,那么您最好将它们放入 Lucene 索引中。

If you're going to need the attributes frequently when a document is retrieved, I would stick them in the index. If their use will be infrequent, I would use option 2 or 3. If you know when you need them and when you don't, you can use a FieldSelector to control whether (or which) attributes get loaded.

Another factor to consider is the cardinality of the attributes and whether you might consider incorporating their values into queries or ranking algorithms. If the answer is yes, then you're much better off sticking them into the Lucene index.

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