1

I am trying to index two tables(entities) from mysql to apache solr.

Here is my data-config.xml

<document name="analysis">
    <entity name="analysis" query="SELECT * FROM analysis">
        <field column="id" name="id" />
        <field column="doc_type" template="analysis" />
        <field column="nid" name="analysis_nid" template="analysis_${analysis.nid}" />
        <field column="sid" name="analysis_sid" template="analysis_${analysis.sid}" />
        <field column="headline" name="headline" />
    </entity>

    <entity name="analysis_source" transformer="TemplateTransformer"  query="select * from analysis_source limit 5">
        <field column="doc_id" template="analysis_source_${analysis_source.id}" name="doc_id"/>
        <field column="doc_type" template="analysis_source" name="doc_type" />
        <field column="nid" name="analysis_source_nid" template="analysis_source_${analysis_source.nid}" />
        <field column="sid" name="analysis_source_sid" template="analysis_source_${analysis_source.sid}" />
        <field column="tax_payer_name" name="tax_payer_name"/>
    </entity>
</document>

and here is my managed-schema file

<field name="id" type="int" indexed="true" stored="true" />
<field name="doc_type" type="string" indexed="true" stored="true" />

<field name="analysis_source_nid" type="int" indexed="true" stored="true" />
<field name="analysis_source_sid" type="int" indexed="true" stored="true"/>
<field name="tax_payer_name" type="string" indexed="true" stored="true"/>

<field name="analysis_nid" type="int" indexed="true" stored="true" />
<field name="analysis_sid" type="int" indexed="true" stored="true"/>
<field name="headline" type="string" indexed="true" stored="true"/>

<uniqueKey>doc_id</uniqueKey>

The issue is whenver I tried to dataimport from solr admin UI, it only imports analysis_source entity. I tried different tweaks but did not work.

I followed following link to have multiple entities indexed

How to index and search two different tables

Community
  • 1
  • 1
Nilesh
  • 442
  • 1
  • 4
  • 22

1 Answers1

1

I checked log files and there is error "reading from database error". I changed my query from "select * from analysis" to "select col1,col2 from analyis"

I guess there is an issue with compatibility for column structures (data types) in apache solr and mysql.

so need to keep in mind column datatype.

Nilesh
  • 442
  • 1
  • 4
  • 22