在 mySQL 数据库上创建搜索

发布于 2024-08-16 10:34:01 字数 802 浏览 6 评论 0原文

我正在尝试通过 mySQL 数据库创建对我的网站的搜索。我开始使用 Sphinx 但在得知索引不会实时更新时犹豫不决。我确实看到他们有几乎实时更新,但我很担心这不太适合我的系统,因为新内容每分钟都会添加到数据库中。这些新内容需要立即添加,并且每次更新后重新索引似乎很奇怪。

我目前正在研究 Solr 它是基于 Lucene 构建的,但这似乎也不适合我需要,因为它更多的是基于文件的搜索而不是数据库搜索。对于相对简单的搜索来说,它的配置看起来也非常多。

我还发现这个stackoverflow问题 但也遇到了一些问题。首先,我并不是只在一个领域进行搜索,而是在多个领域进行搜索。另外,我担心纯粹用 SQL 完成的搜索可能会在我的数据库上太慢,该数据库有望存储数十万条记录,甚至更多。

如果有人对我提到的或我没有提到的任何软件有任何意见,欢迎提出所有想法。我使用 java 作为后端,如果这有什么区别的话。谢谢。

I am trying to create a search for my website over a mySQL database. I started down the line of using Sphinx but was hesitant when learning that the index doesn't update in real time. I did see they have an almost real time update but I am concerned this doesn't fit my system well because new content is added to the database on a minute by minute basis. This new content needs to be added immediately and re-indexing after each update seems strange.

I am currently looking into Solr which is built on Lucene but this also doesn't seem to fit my needs because it is more of a file based search instead of a database search. It also looks like an awful lot to configure for a relatively simple search.

I also found this stackoverflow question but had a few problems with it as well. The first is that I am not searching through just one field but many. Also, I am worried that searches done purely in SQL may be too slow over my database which will hopefully store in the hundreds of thousands of records, if not more.

If anyone has any opinions on any of the software I have mentioned or any that I haven't, all ideas are welcome. I am using java for the back-end if that makes any difference. Thanks.

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

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

发布评论

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

评论(2

拿命拼未来 2024-08-23 10:34:01

从本质上讲,数据库只是文件。基于文件的搜索有什么问题?

听起来 Solr 满足您的要求。如果您使用他们在下载中提供的示例设置,则无需太多入门知识。您需要做的就是为您的数据配置 schema.xml。

要获得实时搜索,您需要将文档实时添加到 solr 索引中。这可以简单地发布到 Solr 的 servlet 之一,也可以通过 SolrJ(他们的 java 客户端)来完成。

如果您要搜索很多列,我认为 Solr 会比数据库更高效、更易于使用。它还将提供更丰富的功能集,例如分面和词干。

At their core, databases are just files. What is wrong with a file based search?

It sounds like Solr fulfills your requirements. If you use their example setup they provide in their download, there isnt much to getting started. All you would need to do is configure your schema.xml for your data.

To get real-time search you would need to add your documents to the solr index in real time. This is a simple to post to one of Solr's servlets or can be done through SolrJ (their java client).

If you are searching over many columns, I think Solr will be more efficient and easier to use than a database. It will also provide a richer feature set such as faceting and stemming.

若水微香 2024-08-23 10:34:01

还有普通的 Lucene 和 Xapian —— 后者具有 PHP 绑定。

There is also just plain Lucene and Xapian --- the latter has PHP-bindings.

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