Lucene 或 Mysql 全文搜索 [英] Lucene or Mysql Full text search

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

问题描述

如今,当开始一个网络/移动应用项目时,搜索将成为一个重要的变量.是从一开始就使用 Lucene 还是快速部署基于 MySQL 的解决方案并希望最好?

Nowadays when starting a web/mobile app project in which search is going to be an important variable. Is it better to go with Lucene from the start or quickly deploy a MySQL based solution and hope for the best?

推荐答案

我在 2010 年 11 月做出了同样的决定.我是 mysql 的朋友,并尝试首先在 mysql 上构建一个搜索应用程序 - 效果很好.........而且很快(我认为它很快):搜索 200.000 个文档(不超过 2-3 秒)

I had the same decision in November 2010. I'm a friend of mysql and tried to build an search application on mysql first - which works well... ...and fast (i thought it was fast): searching in 200.000 documents (in not more than 2-3 second)

我避免花时间在 lucene/solr 上,因为我想利用这段时间来开发应用程序.并且:lucene对我来说是新的......我不知道,如果它足够好,我不知道它是什么......最后:你无法改变一生的习惯.

I avoided spending time to lucene/solr, because i would like to use this time for developing the application. And: lucene was new for me... I don't know, if it is good enough, i don't know what it is.... Finally: You can't change the habits of a lifetime.

但是,我遇到了模糊搜索(在 mysql 中很难实现)或更像这样"(必须在使用 mysql 的应用程序中从 scrat 编码或简单使用更像这样")的不同问题solr 功能开箱即用).最后文档数上升到一百万,现在mysql需要超过15秒的时间来搜索文档.

However, i run in different problems with fuzzy search (which is difficult to implement in mysql) or "more like this" (which have to be coded from scrat in an application using mysql or simple use that "more like this" solr-feature out of the box). Finally the number of documents rises up to a million and mysql needs now more than 15 seconds to search into the documents.

所以我决定从 lucene 开始,感觉就像打开了一扇通往新世界的大门.许多功能(我几乎没有编码应用程序功能)现在由 solr 提供并且开箱即用.全文搜索要快得多:在 100 万个文档中不到 50 毫秒,如果被缓存,则不到 1 毫秒.

So i decided to start with lucene and it feels like i opened a door to a new world. Lot's of features (i hardly coded application-features) are now provided from solr and working out of the box. The fulltext searches are much, much faster: less than 50ms in 1 million Documents, less than 1ms, if it is cached.

所以投入的时间得到了回报.

So the invested time has paid off.

因此,如果您考虑进行全文搜索:如果您有多个数据,请使用 lucene.顺便说一句:我正在使用混合结构:将数据保存在 mysql 和 lucene 中只是一个索引(几乎)没有存储数据(以保持该索引小而快).

So if you think about to make an fulltext search: take lucene, if you have mor than a couple of data. By the way: i'm using an hybrid construct: holding the data in mysql and lucene is only an index with (nearly) no stored data (to keep that index small and fast).

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

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