Hello,

I am using the new collection alias feature, and it seems
CloudSolrServer class (solrj 4.2.0) does not allow to use it, either for
update or select.

When I'm requesting the CloudSolrServer with a collection alias name, I
have the error:
org.apache.solr.common.SolrException: Collection not found:
aliasedCollection

The collection alias cannot be found because, in
CloudSolrServer#getCollectionList (line 319) method, the alias variable
is always empty.

When I'm requesting the CloudSolrServer, the connect method is called
and it calls the ZkStateReader#createClusterStateWatchersAndUpdate method.
In the ZkStateReader#createClusterStateWatchersAndUpdate method, the
aliases are not loaded.

line 295, the data from /clusterstate.json are loaded :
ClusterState clusterState = ClusterState.load(zkClient, liveNodeSet);
this.clusterState = clusterState;

Should we have the same data loading from /aliases.json, in order to
fill the aliases field ?
line 299, a Watcher for aliases is created but does not seem used.


As a workaround to avoid the error, I have to force the aliases loading
at my application start and when the aliases are updated:
CloudSolrServer solrServer = new CloudSolrServer("localhost:2181");
solrServer.setDefaultCollection("aliasedCollection");
solrServer.connect();
solrServer.getZkStateReader().updateAliases();

Is there a better way to use collection aliases with solrj ?

Elodie Sannier

Kelkoo SAS
Société par Actions Simplifiée
Au capital de € 4.168.964,30
Siège social : 8, rue du Sentier 75002 Paris
425 093 069 RCS Paris

Ce message et les pièces jointes sont confidentiels et établis à l'attention 
exclusive de leurs destinataires. Si vous n'êtes pas le destinataire de ce 
message, merci de le détruire et d'en avertir l'expéditeur.

Reply via email to