Lucene索引 [英] Lucene Indexing

查看:108
本文介绍了Lucene索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Lucene为现有数据库中的表建立索引.我一直在想这个过程就像:

I would like to use Lucene for indexing a table in an existing database. I have been thinking the process is like:

  1. 为表中的每一列创建一个字段"
  2. 存储所有字段
  3. 分析"除具有主键的字段以外的所有其他字段
  4. 将表中的每一行存储为Lucene文档.

尽管此表中的大多数列都较小,但其中一列却很大.该列也是包含要执行搜索的大量数据的列.

While most of the columns in this table are small in size, one is huge. This column is also the one containing the bulk of the data on which searches will be performed.

我知道Lucene提供了不存储字段的选项.我在想两种解决方案:

I know Lucene provides an option to not store a Field. I was thinking of two solutions:

  1. 存储字段,无论其大小如何,如果找到搜索命中,请从文档中获取适当的字段
  2. 不存储字段,如果发现搜索命中,请查询数据库以获取相关信息

我意识到可能没有一个适合所有答案的尺寸...

I realize there may not be a one size fits all answer ...

推荐答案

可以肯定的是,如果将所有内容存储在Lucene上,您的系统将具有更高的响应速度.存储字段不会影响查询时间,只会增加索引的大小.如果只有一小部分具有大量数据的行,则可能不会更大.因此,如果索引大小对您的系统而言不是问题,那么我会考虑的.

For sure, your system will be more responsive if you store everything on Lucene. Stored field does not affect the query time, it will only make the size of your index bigger. And probably not that bigger if it is only a small portion of the rows that have a lot of data. So if the index size is not an issue for your system, I would go with that.

这篇关于Lucene索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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