lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gora Mohanty <g...@mimirtech.com>
Subject Re: How to configure schema.xml to take in account two database tables?
Date Sun, 05 Aug 2012 12:19:43 GMT
On 5 August 2012 17:17, Andre Lopes <lopes80andre@gmail.com> wrote:
> Hi,
>
> I'm new to Solr. I've take some reads about how it works, but I can't
> find a clue for my specific situation.
>
> Here is my case. I've 2 database tables that I need to add to the
> index, but they are related. One entry in the table "clients" could
> have more than one entry in the table "contacts".
[...]

There seem to be various things that you need clarity on:
1. Firstly, schema.xml describes the various fields that you
    might be indexing, and/or storing in Solr. Thus, it should
    contain a description for each field that you will be using,
    no matter what data source the field might come from.
2. One typically flattens data when indexing into Solr.
    Following your example, as customers can have multiple
    phone numbers, you should denormalise your data.
    E.g., each Solr record could have these fields:
       <cust. name>, <cust. desc.>, <phone>
    Thus, for customer 1 you would need two records, for
    customer 2 one record, and for customer 3 three records.

    You might find this blog useful, though it probably has
     more detail than you need:
     http://mysolr.com/tips/denormalized-data-structure/
3. You will need some way to index the data into Solr. One
    way is to use the DataImportHandler which allows
    indexing from multiple databases:
    http://wiki.apache.org/solr/DataImportHandler

Regards,
Gora

Mime
View raw message