Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Plain View
Solr, mail # user - Programmatic create core


+
"Trym R. Møller" 2012-05-07, 06:12
+
Mark Miller 2012-05-07, 15:33
Copy link to this message
-
Re: Programmatic create core
"Trym R. Møller" 2012-05-07, 18:53
Thanks Mark you are my hero!

I had missed the specification of the configuration of the collection
and the only way to specify it was as follows:
         CoreAdminRequest.Create req = new CoreAdminRequest.Create() {
             @Override
             public SolrParams getParams() {
                 return ((ModifiableSolrParams)
super.getParams()).set("collection.configName",
"myCollectionConfigurationName");
             }
         };

Is there other ways to specify it or should the CoreAdminRequest be
enhanced with this property?

Best regards Trym
Den 07-05-2012 17:33, Mark Miller skrev:
> Thanks - I'll fix that retry count issue right now.
>
> When you go to the admin UI and look at the zookeeper nodes, what is listed
> under config? I'll add the config names found to that error message.
>
> - Mark
>
> On Mon, May 7, 2012 at 2:12 AM, "Trym R. Møller"<[EMAIL PROTECTED]>  wrote:
>
>> Hi
>>
>> On Solr trunk I am trying to create a new core using the following code:
>>         CoreAdminRequest.Create req = new CoreAdminRequest.Create();
>>         req.setCoreName(shardName);
>>         req.setInstanceDir(**instanceDir);
>>         req.setDataDir(dataDir);
>>         req.setCollection(**collectionName);
>>         req.setShardId(shardId);
>>         req.setConfigName(configName);
>>         CommonsHttpSolrServer httpSolrServer = new CommonsHttpSolrServer("
>> http://**localhost:8983/solr/<http://localhost:8983/solr/>");
>>
>>         req.process(httpSolrServer);
>>
>> But it fails on the server with an exception, (see the stacktrace below).
>> It seems as if it cannot find the config name of the collection, but I
>> thought I specified it in "req.setConfigName(configName)**;"?
>> Looking into code it seems like the parameter name zk is looking for is
>> "configName" and the parameter name solrj (CoreAdminRequest) sets is
>> "config" but I am uncertain if it is converted and if it represent the same
>> thing.
>>
>> Furthermore when looking into svn I see that a bug must have sneaked into
>> the
>> /lucene/dev/trunk/solr/core/**src/java/org/apache/solr/**
>> cloud/ZkController.java
>> between Revision: 1296692 and Revision: 1294466
>>   In the last condition:
>>     int retry = 1;
>>     for (; retry<  6; retry++) {
>>     ...
>>     }
>>     if (retry == 10) {
>>
>> Any comments are appreciated.
>>
>> Best regards Trym
>>
>> 06-05-2012 17:15:53 org.apache.solr.common.**SolrException log
>> SEVERE: org.apache.solr.common.**SolrException: Error executing default
>> implementation of CREATE
>>     at org.apache.solr.handler.admin.**CoreAdminHandler.**
>> handleCreateAction(**CoreAdminHandler.java:401)
>>     at org.apache.solr.handler.admin.**CoreAdminHandler.**
>> handleRequestBody(**CoreAdminHandler.java:141)
>>     at org.apache.solr.handler.**RequestHandlerBase.**handleRequest(**
>> RequestHandlerBase.java:129)
>>     at org.apache.solr.servlet.**SolrDispatchFilter.**handleAdminRequest(**
>> SolrDispatchFilter.java:360)
>>     at org.apache.solr.servlet.**SolrDispatchFilter.doFilter(**
>> SolrDispatchFilter.java:173)
>>     at org.mortbay.jetty.servlet.**ServletHandler$CachedChain.**
>> doFilter(ServletHandler.java:**1212)
>>     at org.mortbay.jetty.servlet.**ServletHandler.handle(**
>> ServletHandler.java:399)
>>     at org.mortbay.jetty.security.**SecurityHandler.handle(**
>> SecurityHandler.java:216)
>>     at org.mortbay.jetty.servlet.**SessionHandler.handle(**
>> SessionHandler.java:182)
>>     at org.mortbay.jetty.handler.**ContextHandler.handle(**
>> ContextHandler.java:766)
>>     at org.mortbay.jetty.webapp.**WebAppContext.handle(**
>> WebAppContext.java:450)
>>     at org.mortbay.jetty.handler.**ContextHandlerCollection.**handle(**
>> ContextHandlerCollection.java:**230)
>>     at org.mortbay.jetty.handler.**HandlerCollection.handle(**
>> HandlerCollection.java:114)
>>     at org.mortbay.jetty.handler.**HandlerWrapper.handle(**
>> HandlerWrapper.java:152)
>>     at org.mortbay.jetty.Server.**handle(Server.java:326)