No, you cannot just use the collection name. Replicas are just cores.
You can host many replicas of a single collection on a single Solr node
in a single CoreContainer (there’s only one per Solr JVM). If you just
specified a collection name how would the code have any clue which 
of the possibilities to return?

The name is in the form collection_shard1_replica_n21

How do you know where the doc you’re working on? Put the ID through
the hashing mechanism.

This isn’t the same at all if you’re running stand-alone, then there’s only
one name.

But as I indicated above, your ask for just using the collection name isn’t
going to work by definition.

So perhaps this is an XY problem. You’re asking about getCore, which is
a very specific, low-level concept. What are you trying to do at a higher
level? Why do you think you need to get a core? What do you want to _do_
with the doc that you need the core it resides in?

Best,
Erick

> On Aug 28, 2019, at 5:28 PM, Arnold Bronley <arnoldbron...@gmail.com> wrote:
> 
> Wait, would I need to use core name like  collection1_shard1_replica_n4
> etc/? Can't I use collection name? What if  I have multiple shards, how
> would I know where does the document that I am working with lives in
> currently.
> I would rather prefer to use collection name and expect the core
> information to be abstracted out that way.
> 
> On Wed, Aug 28, 2019 at 5:13 PM Erick Erickson <erickerick...@gmail.com>
> wrote:
> 
>> Hmmm, should work. What is your core_name? There’s strings like
>> collection1_shard1_replica_n4 and core_node6. Are you sure you’re using the
>> right one?
>> 
>>> On Aug 28, 2019, at 3:56 PM, Arnold Bronley <arnoldbron...@gmail.com>
>> wrote:
>>> 
>>> Hi,
>>> 
>>> In a custom Solr plugin code,
>>> req.getCore().getCoreContainer().getCore(core_name) is returning null
>> even
>>> if core by name core_name is loaded and up in Solr. req is object
>>> of SolrQueryRequest class. I am using Solr 8.2.0 in SolrCloud mode.
>>> 
>>> Any ideas on why this might be the case?
>> 
>> 

Reply via email to