You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jueljust <ju...@gmail.com> on 2012/06/21 13:11:47 UTC

how to import product of entity date with DIH

i need to import data from sql server and cassandra
first, get user ids from sql server
then get one user's characters from cassandra by user id
last, save the users characters doc into solr
one user have multi charcters
and i need to save the doc like 

1040.txt
<row uniqueid="10031016578048" passportid="1040" character="Ranea"/>
<row uniqueid="10031016578049" passportid="1040" character="assinissa"/>
<row uniqueid="1005101793120" passportid="1040" character="AmmSmashYous"/>
<row uniqueid="1005101793121" passportid="1040" character="Dangless"/>
<row uniqueid="1007102768032" passportid="1040" character="sees"/>
<row uniqueid="10131031905" passportid="1040" character="Loopz"/>
<row uniqueid="10131031907" passportid="1040" character="MyLongName"/>
<row uniqueid="10141031680" passportid="1040" character="Rawr"/>
<row uniqueid="10261043118" passportid="1040" character="Firebald"/>
<row uniqueid="10191054480" passportid="1040" character="salt"/>

19734880.txt
<row uniqueid="10091011208112" passportid="19734880" character="3Negreteo"
/>
<row uniqueid="10091011208113" passportid="19734880" character="3BlaKin" />

field uniqueid is  character id
field passportid is user id
field character is character name

i write the DIH config like the following

<dataConfig>
	<dataSource name="mssql"
		driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
		url="jdbc:sqlserver://localhost:1433;databaseName=pw_account;" />
    <dataSource name="url" type="URLDataSource" />
    <dataSource name="reader" type="FieldReaderDataSource" />
    <document>
        <entity name="user" dataSource="mssql"
            query="SELECT top 100 id FROM pw_account..account">
            <entity name="line" dataSource="url"
processor="LineEntityProcessor"
                url="http://localhost/${user.id}.txt"
                format="text" encoding="UTF-8" connectionTimeout="5000"
readTimeout="100000">
                <entity name="xml" dataSource="reader"
processor="XPathEntityProcessor" 
                    dataField="line.rawLine" forEach="/row"
rootEntity="false">
                    <field column="id" name="id" xpath="/row/@uniqueid" />
                    <field column="character" name="character"
xpath="/row/@character" />
                    <field column="passportid" name="passportid"
xpath="/row/@passportid" />
                </entity>
            </entity>
        </entity>
    </document>
</dataConfig>


but it doesn't work

i got the result in csv format like this

id,passportid,character
1,1040,Ranea
2,,
3,,
4,,

only user_1040 's first character's is imported, and the imported ids are
all wrong

how to write the correct DIH config?

regards


--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-import-product-of-entity-date-with-DIH-tp3990694.html
Sent from the Solr - User mailing list archive at Nabble.com.