Hi Shawn,

First thank you for taking the time to answer me.

Actually i tried looking for a way to use SolrJ to upload my files, but i
cannot find anywhere informations about how to create nodes with their
config files using SolrJ.
All websites, blogs and docs i found seem to be based on the principle that
the core already exist or that the config files are already there.

I tried using SolrJ anyway, using CoreAdminRequest.create(), but i can only
pass a config file name and a schema file name, not the files themselves,
so i don't see how to do this.
Result of this try is :
INFO: Sending SolR config ...
4226 [AWT-EventQueue-0] INFO
org.apache.solr.client.solrj.impl.HttpClientUtil - Creating new http
client,
config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: No
resource solrconfig.xml for core solrks.villes_france, did you miss to
upload it?
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:402)
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
at
org.apache.solr.client.solrj.request.CoreAdminRequest.process(CoreAdminRequest.java:462)
at
org.apache.solr.client.solrj.request.CoreAdminRequest.createCore(CoreAdminRequest.java:534)
at
org.apache.solr.client.solrj.request.CoreAdminRequest.createCore(CoreAdminRequest.java:514)




*Frédéric Esnault*
CTO / CO-FOUNDER

*SERENZIA*
57 Rue Maurice Bokanowski
92600 Asnières-sur-Seine

Tel : +33 6 49 45 53 38
Mail : fesna...@serenzia.com




2014-06-20 15:35 GMT+02:00 Shawn Heisey <s...@elyograg.org>:

> On 6/20/2014 5:16 AM, Frederic Esnault wrote:
> > I know how to send solrconfig.xml and schema.xml files to SolR using curl
> > commands.
> > But my problem is that i want to send them with java, and i can't find a
> > way to do so.
> > I used HttpComponentsand got http headers before the file begins, which
> SAX
> > parser does not like at all.
> >
> > What is the best way to send this files from a java program ?
>
> Chances are good that you can duplicate your curl requests with
> HttpSolrServer and SolrQuery, part of solrj, which is in the Solr
> download under the dist directory.
>
> If you are running SolrCloud, then the configs in Zookeeper are directly
> accessible with Java code.  You should take a look at the source code,
> in ZkController#uploadConfigDir, to see how the uploadToZK methods work.
>  You should be able to use the SolrZkClient#makePath method, just like
> uploadToZK does.
>
> To use SolrZKClient (or the requests similar to what you do now with
> curl), you will need the solrj jar and it's dependencies.  The
> recommended versions of those dependencies can be found in the download,
> in the dist/solrj-lib directory.  To get the SolrZkClient, you would
> need to establish a CloudSolrServer object, then retrieve the
> ZkStateReader from the CloudSolrServer, and the SolrZkClient from the
> ZkStateReader.
>
> Thanks,
> Shawn
>
>

Reply via email to