0

We are using apache solr to implement search in our application. The search will be such that the user can search for employees, offices or both. We need to have auto suggest feature and search for the same. My question is how do i import data from two tables without using a join(As offices and tables are not related directly) in db-data-config file. I tried using two entities but it gave me an error saying the unique key needed to be the same.

Also how do i configure the fields of these two entities in the schema.xml file

Please help

2 Answers2

0

It sounds like what you have are two different types of document that you want to index in Solr. To do this I believe you will need to set up a multi-core solr instance with separate schema.xml files for each one.

For more information see this question:

what is SOLR multicore exactly

And here:

https://wiki.apache.org/solr/CoreAdmin

Community
  • 1
  • 1
Woodham
  • 4,053
  • 2
  • 20
  • 15
0

You should be perfectly ok with single core and multiple entities.

You just need to have some discriminator that you append to ID column in your database (if it's numeric and you want to use it as identity in Solr).

You would also like to have some column that keeps your data type and declare fields from all tables in Solr document.

Keep in mind that Solr schema is not the same as SQL schema. You can have many fields declared in schema.xml but only use few of them in your documents. It costs nothing. Only fields you actually set are stored.

I've been loading data for many data types with different schema to Solr in my previous project. Let me know if you need some examples, I'll try to find them.

More info about data import in solr: http://wiki.apache.org/solr/DataImportHandler

Marek Piechut
  • 557
  • 4
  • 9