I would like to index my database using SolrJ Java API. I have already tried
to use DIH directly from the Solr server. It works and indexes well. But
when I would like to use the same XML config file with SolrJ it throws an
error. 

**Solr version 7.6.0 SolrJ 7.6.0**

Here is the full code I am using:

            String url = "http://localhost:8983/solr/test";;
                String dataConfig =
"D:/solr-7.6.0/server/solr/test/conf/solrconfig.xml";
                HttpSolrClient server = new HttpSolrClient.Builder(url).build();
                ModifiableSolrParams params = new ModifiableSolrParams();
                params.set("qt", "/dataimport");
                params.set("command", "full-import");
                params.set("clean", "true");
                params.set("commit", "true");
                params.set("optimize", "true");
                params.set("dataConfig",dataConfig);
                server.query(params);

But using this piece of code throws an error. 

    Exception in thread "main"
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error
from server at http://localhost:8983/solr/test: Data Config problem: Content
is not allowed in Prolog.

Am I doing it right? Reference:
https://stackoverflow.com/questions/31446644/how-to-do-solr-dataimport-i-e-from-rdbms-using-java-api/54905578#54905578

Is there any other way to index directly. 



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to