You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ryan Josal <rj...@rim.com> on 2013/02/05 22:09:14 UTC
Correct way for getting SolrCore?
Hey guys,
I am writing an UpdateRequestProcessorFactory plugin which needs to have some initialization code in the init method. I need to build some information about each SolrCore in memory so that when an update comes in for a particular SolrCore, I can use the data for the appropriate core. Ultimately, I need a lucene IndexReader for each core. I figure I'd get this through a SolrCore, CoreContainer, or CoreDescriptor. I've looked around for awhile and I always end up going in circles. So how can I iterate over cores that have been loaded?
Ryan
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
RE: Correct way for getting SolrCore?
Posted by Ryan Josal <rj...@rim.com>.
This is perfect, thanks! I'm surprised it eluded me for so long.
________________________________________
From: Mark Miller [markrmiller@gmail.com]
Sent: Tuesday, February 05, 2013 4:09 PM
To: solr-user@lucene.apache.org
Subject: Re: Correct way for getting SolrCore?
The SolrCoreAware interface?
- Mark
On Feb 5, 2013, at 5:42 PM, Ryan Josal <rj...@rim.com> wrote:
> By way of the deprecated SolrCore.getSolrCore method,
>
> SolrCore.getSolrCore().getCoreDescriptor().getCoreContainer().getCores()
>
> Solr starts up in an infinite recursive loop of loading cores. I understand now that the UpdateProcessorFactory is initialized as part of the core initialization, so I expect there is no way to read the index of a core if the core has not been initialized yet. I still feel a bit uneasy about initialization on the first update request, so is there some other place I can plugin initialization code that runs after the core is loaded? I suppose I'd be using SolrCore.getSearcher().get().getIndexReader() to get the IndexReader, but if that happens after a good point of plugging in this initialization, then I guess SolrCore.getIndexReaderFactory() is the way to go.
>
> Thanks,
> Ryan
> ________________________________________
> From: Ryan Josal [rjosal@rim.com]
> Sent: Tuesday, February 05, 2013 1:27 PM
> To: solr-user@lucene.apache.org
> Subject: RE: Correct way for getting SolrCore?
>
> Is there any way I can get the cores and do my initialization in the @Override public void init(final NamedList args) method? I could wait for the first request, but I imagine I'd have to deal with indexing requests piling up while I iterate over every document in every index.
>
> Ryan
> ________________________________________
> From: Mark Miller [markrmiller@gmail.com]
> Sent: Tuesday, February 05, 2013 1:15 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Correct way for getting SolrCore?
>
> The request should give you access to the core - the core to the core descriptor, the descriptor to the core container, which knows about all the cores.
>
> - Mark
>
> On Feb 5, 2013, at 4:09 PM, Ryan Josal <rj...@rim.com> wrote:
>
>> Hey guys,
>>
>> I am writing an UpdateRequestProcessorFactory plugin which needs to have some initialization code in the init method. I need to build some information about each SolrCore in memory so that when an update comes in for a particular SolrCore, I can use the data for the appropriate core. Ultimately, I need a lucene IndexReader for each core. I figure I'd get this through a SolrCore, CoreContainer, or CoreDescriptor. I've looked around for awhile and I always end up going in circles. So how can I iterate over cores that have been loaded?
>>
>> Ryan
>> ---------------------------------------------------------------------
>> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
>
>
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
>
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
Re: Correct way for getting SolrCore?
Posted by Mark Miller <ma...@gmail.com>.
The SolrCoreAware interface?
- Mark
On Feb 5, 2013, at 5:42 PM, Ryan Josal <rj...@rim.com> wrote:
> By way of the deprecated SolrCore.getSolrCore method,
>
> SolrCore.getSolrCore().getCoreDescriptor().getCoreContainer().getCores()
>
> Solr starts up in an infinite recursive loop of loading cores. I understand now that the UpdateProcessorFactory is initialized as part of the core initialization, so I expect there is no way to read the index of a core if the core has not been initialized yet. I still feel a bit uneasy about initialization on the first update request, so is there some other place I can plugin initialization code that runs after the core is loaded? I suppose I'd be using SolrCore.getSearcher().get().getIndexReader() to get the IndexReader, but if that happens after a good point of plugging in this initialization, then I guess SolrCore.getIndexReaderFactory() is the way to go.
>
> Thanks,
> Ryan
> ________________________________________
> From: Ryan Josal [rjosal@rim.com]
> Sent: Tuesday, February 05, 2013 1:27 PM
> To: solr-user@lucene.apache.org
> Subject: RE: Correct way for getting SolrCore?
>
> Is there any way I can get the cores and do my initialization in the @Override public void init(final NamedList args) method? I could wait for the first request, but I imagine I'd have to deal with indexing requests piling up while I iterate over every document in every index.
>
> Ryan
> ________________________________________
> From: Mark Miller [markrmiller@gmail.com]
> Sent: Tuesday, February 05, 2013 1:15 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Correct way for getting SolrCore?
>
> The request should give you access to the core - the core to the core descriptor, the descriptor to the core container, which knows about all the cores.
>
> - Mark
>
> On Feb 5, 2013, at 4:09 PM, Ryan Josal <rj...@rim.com> wrote:
>
>> Hey guys,
>>
>> I am writing an UpdateRequestProcessorFactory plugin which needs to have some initialization code in the init method. I need to build some information about each SolrCore in memory so that when an update comes in for a particular SolrCore, I can use the data for the appropriate core. Ultimately, I need a lucene IndexReader for each core. I figure I'd get this through a SolrCore, CoreContainer, or CoreDescriptor. I've looked around for awhile and I always end up going in circles. So how can I iterate over cores that have been loaded?
>>
>> Ryan
>> ---------------------------------------------------------------------
>> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
>
>
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
>
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
RE: Correct way for getting SolrCore?
Posted by Ryan Josal <rj...@rim.com>.
By way of the deprecated SolrCore.getSolrCore method,
SolrCore.getSolrCore().getCoreDescriptor().getCoreContainer().getCores()
Solr starts up in an infinite recursive loop of loading cores. I understand now that the UpdateProcessorFactory is initialized as part of the core initialization, so I expect there is no way to read the index of a core if the core has not been initialized yet. I still feel a bit uneasy about initialization on the first update request, so is there some other place I can plugin initialization code that runs after the core is loaded? I suppose I'd be using SolrCore.getSearcher().get().getIndexReader() to get the IndexReader, but if that happens after a good point of plugging in this initialization, then I guess SolrCore.getIndexReaderFactory() is the way to go.
Thanks,
Ryan
________________________________________
From: Ryan Josal [rjosal@rim.com]
Sent: Tuesday, February 05, 2013 1:27 PM
To: solr-user@lucene.apache.org
Subject: RE: Correct way for getting SolrCore?
Is there any way I can get the cores and do my initialization in the @Override public void init(final NamedList args) method? I could wait for the first request, but I imagine I'd have to deal with indexing requests piling up while I iterate over every document in every index.
Ryan
________________________________________
From: Mark Miller [markrmiller@gmail.com]
Sent: Tuesday, February 05, 2013 1:15 PM
To: solr-user@lucene.apache.org
Subject: Re: Correct way for getting SolrCore?
The request should give you access to the core - the core to the core descriptor, the descriptor to the core container, which knows about all the cores.
- Mark
On Feb 5, 2013, at 4:09 PM, Ryan Josal <rj...@rim.com> wrote:
> Hey guys,
>
> I am writing an UpdateRequestProcessorFactory plugin which needs to have some initialization code in the init method. I need to build some information about each SolrCore in memory so that when an update comes in for a particular SolrCore, I can use the data for the appropriate core. Ultimately, I need a lucene IndexReader for each core. I figure I'd get this through a SolrCore, CoreContainer, or CoreDescriptor. I've looked around for awhile and I always end up going in circles. So how can I iterate over cores that have been loaded?
>
> Ryan
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
RE: Correct way for getting SolrCore?
Posted by Ryan Josal <rj...@rim.com>.
Is there any way I can get the cores and do my initialization in the @Override public void init(final NamedList args) method? I could wait for the first request, but I imagine I'd have to deal with indexing requests piling up while I iterate over every document in every index.
Ryan
________________________________________
From: Mark Miller [markrmiller@gmail.com]
Sent: Tuesday, February 05, 2013 1:15 PM
To: solr-user@lucene.apache.org
Subject: Re: Correct way for getting SolrCore?
The request should give you access to the core - the core to the core descriptor, the descriptor to the core container, which knows about all the cores.
- Mark
On Feb 5, 2013, at 4:09 PM, Ryan Josal <rj...@rim.com> wrote:
> Hey guys,
>
> I am writing an UpdateRequestProcessorFactory plugin which needs to have some initialization code in the init method. I need to build some information about each SolrCore in memory so that when an update comes in for a particular SolrCore, I can use the data for the appropriate core. Ultimately, I need a lucene IndexReader for each core. I figure I'd get this through a SolrCore, CoreContainer, or CoreDescriptor. I've looked around for awhile and I always end up going in circles. So how can I iterate over cores that have been loaded?
>
> Ryan
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
Re: Correct way for getting SolrCore?
Posted by Mark Miller <ma...@gmail.com>.
The request should give you access to the core - the core to the core descriptor, the descriptor to the core container, which knows about all the cores.
- Mark
On Feb 5, 2013, at 4:09 PM, Ryan Josal <rj...@rim.com> wrote:
> Hey guys,
>
> I am writing an UpdateRequestProcessorFactory plugin which needs to have some initialization code in the init method. I need to build some information about each SolrCore in memory so that when an update comes in for a particular SolrCore, I can use the data for the appropriate core. Ultimately, I need a lucene IndexReader for each core. I figure I'd get this through a SolrCore, CoreContainer, or CoreDescriptor. I've looked around for awhile and I always end up going in circles. So how can I iterate over cores that have been loaded?
>
> Ryan
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.