pysolr icon indicating copy to clipboard operation
pysolr copied to clipboard

pysolr.SolrError: ('Unknown collection: %s", collectionname)

Open EssamEid614 opened this issue 6 years ago • 13 comments

i am trying to use the pysolr api and i am getting this strange error my solr instance is in cloud mode with zookeeper running and i can even see the collection name inside the solr admin browser can anyone help with that ? solr version running is 5.5.3 with zookeeper 3.4.6 on ubuntu server 16.01 with anaconda 3 and python 3

EssamEid614 avatar Oct 26 '17 14:10 EssamEid614

I just pushed ac421dc9ea8f8ed47ab2924f083159b11cc31000 which will at least fix that error message to show the name it expected to find. Do you know which collection name was being passed in and/or have a reproducible test case for this?

acdha avatar Oct 26 '17 19:10 acdha

@acdha sorry for the late reply , i just modified my pysolr.py as well and it still wont find the collection , i added a line to print self.collections which prints "{}" meaning no collections exist for solr is this normal ? i am sure the collection is created i can see it on my solr admin menu and i can see all my nodes are alive also yes i know the collection name its trying to add data to and i tried 2 different collections which i can see in my solr admin view that they exist however they still cant be seen by pysolr

EssamEid614 avatar Oct 29 '17 07:10 EssamEid614

You can change pysolr.ZooKeeper.CLUSTER_STATE = '/collections/{collection_name}/state.json' according to your collection. Then it'll work. Because solr stop managing cluster states in clusterstate.json

uzayr avatar Apr 29 '18 18:04 uzayr

That looks like a bit of a refactor since https://github.com/django-haystack/pysolr/blob/f8489464902edb111f0684cf820401e5baa7234a/pysolr.py#L1279 assumes that the cluster state URL can be known in advance and now it'll need to change when the collection changes.

acdha avatar Jun 22 '18 14:06 acdha

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 20 '18 15:09 stale[bot]

This is still an issue for me

chadgh avatar Dec 05 '18 21:12 chadgh

@chadgh Yes - if you want to contribute a pull request I’m sure it’d be appreciated by the other users

acdha avatar Dec 05 '18 23:12 acdha

@acdha Maybe I will.

For reference it looks like since version 6.3.0 SolrCloud doesn't update the clusterstate.json anymore. http://lucene.472066.n3.nabble.com/clusterstate-json-not-updated-in-zookeeper-after-creating-the-collection-using-API-td4328845.html

I've got a working version of pysolr tweaked a bit after I found that out. I'll do some more testing and submit a PR.

chadgh avatar Dec 06 '18 17:12 chadgh

hi @chadgh , any news on this ?

parisni avatar Jan 12 '19 00:01 parisni

@parisni, Sorry, not really.

I've made a few changes to the pysolr file to get things working with solr cloud 7.3. I have not tested it against other versions of solr and am in the middle of getting things to work for my specific problem.

I have no timeline on when I'll be able to get a solution submitted that is tested and compatible with other versions of solr.

chadgh avatar Jan 15 '19 14:01 chadgh

@chadgh thanks for the answer.

From my side the @uzayr method worked. That's fairly simple. (solr 7.6)

parisni avatar Jan 16 '19 10:01 parisni

@acdha I've run into this as well and would like to contribute a PR. Can you reopen and assign to me please?

rokclimb15 avatar Mar 09 '20 02:03 rokclimb15

Hi, I think I encountered similar issue. My specific use-case is integration testing. It looks like I have this error if I create new instance of pysolr.ZooKeeper too early (maybe service itself is not fully initialized?) For me sleep(5) solves this problem, but I hate that.

btw, @rokclimb15 how is progress?

oskarissimus avatar Apr 22 '22 16:04 oskarissimus