Im trying to Index oracle database 10g XE using Solr's Data Import Handler.

My data-config.xml looks like this

<dataConfig>
<dataSource type="JdbcDataSource" driver="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@XXX.XXX.XXX.XXX:XXXX:xe" user="XXXXXX"
password="XXXXXXXXXX" /> 
<document name="product_info">
<entity name="product" query="select * from product">
<field column="pid" name="id" />  
<field column="pname" name="itemName" /> 
<field column="initqty" name="itemQuantity" />
<field column="remQty" name="remQuantity" />
<field column="price" name="itemPrice" /> 
<field column="specification" name="specifications" /> 
</entity>
</document>
</dataConfig>

My schema.xml looks like this -

<field name="id" type="text_general" indexed="true" stored="true"
required="true" multiValued="false" /> 
   <field name="itemName" type="text_general" indexed="true" stored="true"
multiValued="true" omitNorms="true" termVectors="true" />    
   <field name="itemQuantity" type="text_general" indexed="true"
stored="true" multiValued="true" omitNorms="true" termVectors="true" />   
   <field name="remQuantity" type="text_general" indexed="true"
stored="true" multiValued="true" omitNorms="true" termVectors="true" />   
   <field name="itemPrice" type="text_general" indexed="true" stored="true"
multiValued="true" omitNorms="true" termVectors="true" />   
   <field name="specifications" type="text_general" indexed="true"
stored="true" multiValued="true" omitNorms="true" termVectors="true" />   
   <field name="brand" type="text_general" indexed="true" stored="true"
multiValued="true" omitNorms="true" termVectors="true" />   
   <field name="itemCategory" type="text_general" indexed="true"
stored="true" multiValued="true" omitNorms="true" termVectors="true" /> 

Now when I try to index it, Solr is not able to read the columns of the
table and therefore indexing fails. it says that the document is missing the
unique key id which ,as you can see, is clearly present in document. Also,
generally in the log when such an exception is thrown it is clearly shown
that what all fields were picked up by the document. However in this case,
No fields are being read.

But.... if i change my query then everything works perfectly. The modified
data-config.xml -

<dataConfig>
<dataSource name="db1" type="JdbcDataSource"
driver="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@XXX.XXX.XX.XX:XXXX:xe" user="XXXX"
password="XXXXXXXXX" /> 
<document name="product_info">
<entity name="products" dataSource="db1" query="select pid as id,pname as
itemName,initqty as itemQuantity, remqty as remQuantity, price as itemPrice,
specification as specifications from product">
<field column="id" name="id" /> 
<field column="itemName" name="itemName" /> 
<field column="itemQuantity" name="itemQuantity" />
<field column="remQuantity" name="remQuantity" />
<field column="itemPrice" name="itemPrice" /> 
<field column="specifications" name="specifications" />
</entity>
</document>
</dataConfig>

Why is this happening? how do i solve it? how does giving an alias affect
indexing process? Thanks in advance




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Indexing-Oracle-Database-in-Solr-using-Data-Import-Handler-tp4079649.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to