像关系数据库一样使用Lucene [英] Using Lucene like a relational database

查看:122
本文介绍了像关系数据库一样使用Lucene的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道我们是否可以在lucene中实现一些RDBMS功能。

I am just wondering if we could achieve some RDBMS capabilities in lucene.

示例:
1)我有10,000个项目文档(pdf文件)必须将其内容编入索引,以使其可供搜索。
2)每份文件都与单一项目有关。该项目可以包含项目名称,编号,开始日期,结束日期,位置,类型等详细信息。

Example: 1) I have 10,000 project documents (pdf files) which have to be indexed with their content to make them available for search. 2) Every document is related to a SINGLE PROJECT. The project can contain details like project name, number, start date, end date, location, type etc.

我必须在pdf文件的内容中搜索给定关键字,但在显示结果时,我想显示项目元数据,如第(2)点所述。

I have to search in the contents of the pdf files for a given keyword, but while displaying the results I want to display the project meta data as mentioned in point (2).

我的想法是将名为projectId的字段与每个字段相关联索引时的pdf文件。一旦我们得到它,我们将再次触发搜索以获取项目元数据。

My idea is to associate a field called projectId with each pdf file while indexing. Once we get that, we will fire search again for getting project meta data.

这样我们就可以避免重复数据。此外,如果我们想要更新项目元数据,我们最终只能在SINGLE PLACE更新。否则,如果我们使用所有pdf doument索引存储这个元数据,我们最终会更新所有文档,这不是我想要的方式。

This way we could avoid duplicated data. Also, if we want to update the project meta data we will end up updating at a SINGLE PLACE only. Otherwise if we store this meta data with all the pdf doument indexes, we will end up updating all of the documents, which is not the way I am looking for.

please建议。

推荐答案

你可以这样使用Lucene;

You can use Lucene that way;

优点:

全文搜索很容易实现,而在RDBMS中并非如此。

Full-text search is easy to implement, which is not the case in an RDBMS.

缺点:

参考完整性:您可以在RDBMS中免费获得它,但在Lucene中,您必须自己实现它。

Referential integrity: you get it for free in an RDBMS, but in Lucene, you must implement it yourself.

这篇关于像关系数据库一样使用Lucene的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆