简体   繁体   中英

indexing MySQL in Apache Solr

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM