在Apache Solr中索引MySQL [英] indexing MySQL in Apache Solr

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

问题描述

我正在尝试为我的应用程序构建搜索引擎。我有一个拥有近150个表的mysql数据库。每个表都有一个名为DB_ID的独特字段和其他各种列。现在,当我使用Apache solr索引数据时,仅索引DB_ID列就足够了吗?另外我对Solr很新,从教程中我找不到如何索引Solr中的多个表。就我而言,我有大约150张桌子。那我该如何处理这个问题?

I am trying to build a search engine for my application. I have a mysql database having nearly 150 tables. Each table has a unique field called DB_ID And various other columns. Now when I am indexing the data using Apache solr is it sufficient to index only the DB_ID column? Also I am very new to Solr and from the tutorials I couldnt find how to index multiple tables in Solr. In my case I have around 150 tables. SO how do I go about the problem?

推荐答案

您的DB_ID可能不是一个有用的索引项目。如果您希望能够一般性地搜索数据库中所有表的记录,则可能需要存储每条记录的DB_ID和表名,以及 index any您希望能够搜索的其他字段。您可以使用相同的字段名称(例如 content )索引所有这些字段。这样就可以在内容字段上进行简单搜索,从而搜索每个表的每个记录。我猜想将表名称索引以及存储它也是有用的,这样你可以选择只搜索一个表或表记录的子集。

Your DB_ID is probably not a useful item to index. If you want to be able to search records of all the tables in your database generically, you would probably need to store the DB_IDs and table names of each record, and index any other fields that you wish to be able to search on. You can index all these fields using the same field name (say "content"). This would allow searching across every record of each table with a simple search on the content field. I would guess it would be useful to also index the table name as well as storing it, so that you could optionally search only one table, or a subset of tables records.

一旦在索引中找到了DB记录,就可以获取表名和DB_ID并从数据库中检索记录。

Once a DB record had been found in your index, you could then fetch the table name and DB_ID and retrieve the record from the database.

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

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