2

I am new in solr, I completed setup of solr and also connected with Oracle db and also indexed One table data in solr and check it, it's perfectly fine .

But when inserted more then 1 table data in solr its throw exception

SolrException: Document is missing mandatory uniqueKey field: players _data

I tried in many different different scenarios but all fails. I can't upload data in solr, Please help me

in Data-config.xml file i tried with single document and multiple entity for table and multiple document per table

Data-config.xml

    <dataConfig>  

    <dataSource type="JdbcDataSource" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@127.0.0.1:1521:LOCALDB" user="pbeach" password="sagence" batchSize="1" />  
 <!--   <document name="budget">  
    <entity name="BUDGET_TYPE" query="SELECT * FROM BUDGET_TYPE">  
    <field column="SUBSCRIBER_ID" name="Subscriber-Id" />  
    <field column="COMPANY_ID" name="Company-Id" />  
    <field column="TYPE_CODE" name="Type-Code" />  
    <field column="TYPE_DESCRIPTION" name="Type-Description" />
    <field column="MANAGER_PERSON_ID" name="Manager-Person-Id" />  
    <field column="NOTIFY_ON_NEW_ITEM" name="Notify-On-New-Item" />  
    <field column="CREATION_DATE" name="Creation-Date" />  
    <field column="CREATION_USER" name="Creation-User" />  
    <field column="UPDATE_DATE" name="Update-Date" />   
    <field column="UPDATE_USER" name="Update-User" />   
    </entity>  
    </document>

        <entity name="players_data"  query="SELECT * FROM players_data"
        deltaImportQuery="SELECT * FROM players_data WHERE player_id = '${dih.delta.player_id}'"
        deltaQuery="SELECT * FROM players_data WHERE update_date &gt; TO_DATE('${dih.last_index_time}',' YYYY-MM-DD HH24:MI:SS')">  
            <field column="player_id" name="player_id" />  
            <field column="player_name" name="player_name" />  
            <field column="player_age" name="player_age" />  
            <field column="player_description" name="player_description" />
            <field column="update_date" name="update_date" />   

        </entity>  
    -->

     <document name="player_team_datas">  

        <entity name="player_team_data"  query="SELECT * FROM player_team_data">  
            <field column="id_key" name="id_key" />  
            <field column="team_name" name="team_name" /> 
            <field column="update_date" name="update_date" />   
        </entity>



    </document>  
         <document name="players_datas">  

        <entity name="players_data"  query="SELECT * FROM players_data"
        deltaImportQuery="SELECT * FROM players_data WHERE player_id = '${dih.delta.player_id}'"
        deltaQuery="SELECT * FROM players_data WHERE update_date &gt; TO_DATE('${dih.last_index_time}',' YYYY-MM-DD HH24:MI:SS')">  
            <field column="player_id" name="player_id" />  
            <field column="player_name" name="player_name" />  
            <field column="player_age" name="player_age" />  
            <field column="player_description" name="player_description" />
            <field column="update_date" name="update_date" />   

        </entity> 

    </document>
    </dataConfig>  

Schema.xml

   <field name="players_data" type="string" indexed="true" stored="true" required="true" multiValued="false" />
   <field name="id_key" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 

   <field name="player_name" type="text_general" indexed="true" stored="true"/>
   <field name="player_age" type="int" indexed="true" stored="true"/>
   <field name="player_description" type="text_general" indexed="true" stored="true"/>
   <field name="update_date" type="date" indexed="true" stored="true"/>

   <field name="team_name" type="text_general" indexed="true" stored="true"/>

<uniqueKey>players_data</uniqueKey>
<uniqueKey>id_key</uniqueKey>
RandomSeed
  • 29,301
  • 6
  • 52
  • 87
Maneesh Pal
  • 101
  • 2
  • 10
  • Why did you declare two uniqueKey fields in your schema? The error message states that you try to add a document that lacks one of the uniqueKey fields. This is not allowed. A uniqueKey is required in any means. – cheffe Jan 08 '15 at 08:32
  • i tried with single unique Key and also tried with multiple unique key both not working and gives defined exception – Maneesh Pal Jan 08 '15 at 09:09
  • You are not required to have a uniqueKey. If you do not know what it is good for and which attribute of your entities this should be, leave it out. – cheffe Jan 08 '15 at 09:10
  • tables have composite primary key – Maneesh Pal Jan 08 '15 at 09:14
  • have a read here http://stackoverflow.com/questions/24454755/how-to-set-multiple-fields-as-uniquekey-in-solr – cheffe Jan 08 '15 at 09:24
  • i read this, its not related to multiple tables inserted in solr and its same thing, i have 20 tables and each table have composite primary key and these key not match any of tables – Maneesh Pal Jan 08 '15 at 12:37
  • You can have only one `uniqueKey` for each Solr index. If you have a composite primary key in Oracle, then the best thing to do would be to concatenate all the values (perhaps with a separator like `|`) and use that as the Solr unique key. – David Faber Jan 08 '15 at 14:16

0 Answers0