Hello. 

I have a question about the Solr Data Import Handler. I'm using Solr 5.2.1
on a Linux server with 32G ram.

I have five different collections, and for each collection, I'm trying to
import data from a MySQL database. All of the MySQL queries work properly in
MySQL, and previously I was able to use all of these queries building an
index with Lucid Search 2.9 (Solr 4.7). 

The problem is that when starting Solr it will not finish starting, but does
not give an error, and the admin GUI does not show. If I try to start with
only one collection, it works okay.

I am assuming that the problem has to do either with my incorrect execution
of the data-config file, or use of the unique IDs.

Here is what I have. 

In the data config file (example here, all other data config files are
similar)

<dataConfig>
    <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/Books" user="myuser" password="12345" />
    <document>
        <entity name="book_list" query="SELECT book_id, book_title,
book_date FROM book_list WHERE book_date > '2015-01-01'" >
                 <field column="book_id" name="id" />
                 <field column="book_title" name="title" />
                 <field column="book_date" name="book_date_solr" />
                <entity name="book_author" query="SELECT book_author.full_name,
book_author.full_name_solr FROM book_author LEFT JOIN book_list ON
book_author.book_id = book_list.book_id WHERE book_list.book_id =
${book_list.book_id}" >
                        <field column="full_name" name="full_name" />
                                <field column="full_name_solr" 
name="full_name_solr" />
                </entity>
                <entity name="book_type" query="SELECT 
book_type.publication_type
FROM book_type LEFT JOIN book_list ON book_type.book_id = book_list.book_id
WHERE book_list.book_id = ${book_list.book_id}" >
                        <field column="publication_type" 
name="publication_type" />
                        </entity>
        </entity>
     </document>
</dataConfig>

In schema.xml file (I use the same schema.xml for each collection)

<field name="id" type="string" indexed="true" stored="true"
multiValued="false" required="true" />
<field name="book_id" type="string" indexed="true" stored="false"
multiValued="false" required="false" />
<uniqueKey>id</uniqueKey>

(all fields are added, but I'm not showing here for the sake of brevity)

When Solr is starting, this is as far as it goes:

INFO  - org.apache.solr.core.SolrConfig; Loaded SolrConfig: solrconfig.xml
INFO  - org.apache.solr.schema.IndexSchema; Reading Solr Schema from
/usr/lib/solr-5.2.1/server/solr/Books/conf/schema.xml
INFO  - org.apache.solr.core.SolrConfig; Loaded SolrConfig: solrconfig.xml
INFO  - org.apache.solr.schema.IndexSchema; Reading Solr Schema from
/usr/lib/solr-5.2.1/server/solr/BookStores/conf/schema.xml
INFO  - org.apache.solr.core.SolrConfig; Loaded SolrConfig: solrconfig.xml
INFO  - org.apache.solr.schema.IndexSchema; Reading Solr Schema from
/usr/lib/solr-5.2.1/server/solr/BookSales/conf/schema.xml
INFO  - org.apache.solr.schema.IndexSchema; [Books] Schema name=Schema521
INFO  - org.apache.solr.schema.IndexSchema; [BookStores] Schema name=
Schema521
INFO  - org.apache.solr.schema.IndexSchema; [BookSales] Schema name=
Schema521
INFO  - org.apache.solr.schema.IndexSchema; unique key field: id
INFO  - org.apache.solr.schema.IndexSchema; unique key field: id
INFO  - org.apache.solr.schema.IndexSchema; unique key field: id


I've tried many different alternatives in the above dataconfig, such as

in the query select:
book_id AS id
book_id AS 'id'

and adding pk="book_id" to the entity.

While I'm trying to fix this problem, I also do not understand 

1. Does Solr require that the unique key for a collection must be " id ", or
can it be any name, such as "book_id"?

Any help or guidance would be appreciated.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-DIH-from-MySQL-with-unique-ID-tp4214872.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to