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 Joel Karlsson <87...@gmail.com> on 2008/11/25 12:37:45 UTC

Unknown field error using JDBC

Hello,

I get Unknown field error when I'm indexing an Oracle dB. I've reduced the
number of fields/columns in order to troubleshoot. If I change the uniqeKey
to timestamp (for example) and create a dynamic field <dynamicField name="*"
type="text" indexed="true" stored="true"> the indexing works fine, except
the id-field is empty.

--data-config.xml---------------------------------------------------------------
...

<dataSource driver="oracle.jdbc.OracleDriver"
                    url="jdbc:oracle:thin:@host:port/service-name"
                    user="user"
                    password="pw"
                    name="ds1"/>

...

<entity name="document"
           pk="PUBID"
           query="SELECT PUBID FROM UPLMAIN"
           dataSource="ds1">
            <field column="PUBID" name="id"/>
</entity>

...

--------------------------------------------------------------------------------------

--schema.xml-------------------------------------------------------------------
...

<field name="id" type="text" indexed="true" stored="true" required="true" />

...

<uniqueKey>id</uniqueKey>

...

------------------------------------------------------------------------------------

--ERROR-message--------------------------------------------------------

2008-nov-25 12:25:25 org.apache.solr.handler.dataimport.SolrWriter upload
VARNING: Error creating document :
SolrInputDocument[{PUBID=PUBID(1.0)={43392}}]

org.apache.solr.common.SolrException: ERROR:unknown field 'PUBID'
        at
org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:274)

...

-----------------------------------------------------------------------------------

Anyone who had similar problems or knows how to solve this!? Any help is
truly appreciated!!

// Joel

Re: Unknown field error using JDBC

Posted by Jon Baer <jo...@gmail.com>.
This sounds exactly same issue I had when going from 1.3 to 1.4 ... it  
sounds like DIH is trying to automagically figure out the columns :-\

- Jon

On Nov 25, 2008, at 6:37 AM, Joel Karlsson wrote:

> Hello,
>
> I get Unknown field error when I'm indexing an Oracle dB. I've  
> reduced the
> number of fields/columns in order to troubleshoot. If I change the  
> uniqeKey
> to timestamp (for example) and create a dynamic field <dynamicField  
> name="*"
> type="text" indexed="true" stored="true"> the indexing works fine,  
> except
> the id-field is empty.
>
> --data- 
> config 
> .xml---------------------------------------------------------------
> ...
>
> <dataSource driver="oracle.jdbc.OracleDriver"
>                    url="jdbc:oracle:thin:@host:port/service-name"
>                    user="user"
>                    password="pw"
>                    name="ds1"/>
>
> ...
>
> <entity name="document"
>           pk="PUBID"
>           query="SELECT PUBID FROM UPLMAIN"
>           dataSource="ds1">
>            <field column="PUBID" name="id"/>
> </entity>
>
> ...
>
> --------------------------------------------------------------------------------------
>
> -- 
> schema 
> .xml 
> -------------------------------------------------------------------
> ...
>
> <field name="id" type="text" indexed="true" stored="true"  
> required="true" />
>
> ...
>
> <uniqueKey>id</uniqueKey>
>
> ...
>
> ------------------------------------------------------------------------------------
>
> --ERROR- 
> message--------------------------------------------------------
>
> 2008-nov-25 12:25:25 org.apache.solr.handler.dataimport.SolrWriter  
> upload
> VARNING: Error creating document :
> SolrInputDocument[{PUBID=PUBID(1.0)={43392}}]
>
> org.apache.solr.common.SolrException: ERROR:unknown field 'PUBID'
>        at
> org 
> .apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java: 
> 274)
>
> ...
>
> -----------------------------------------------------------------------------------
>
> Anyone who had similar problems or knows how to solve this!? Any  
> help is
> truly appreciated!!
>
> // Joel