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 Benson Margulies <bi...@gmail.com> on 2013/05/29 13:36:13 UTC
How can a Tokenizer be CoreAware?
I am currently testing some things with Solr 4.0.0. I tried to make a
tokenizer CoreAware, and was rewarded with:
Caused by: org.apache.solr.common.SolrException: Invalid 'Aware'
object: com.basistech.rlp.solr.RLPTokenizerFactory@19336006 --
org.apache.solr.util.plugin.SolrCoreAware must be an instance of:
[org.apache.solr.request.SolrRequestHandler]
[org.apache.solr.response.QueryResponseWriter]
[org.apache.solr.handler.component.SearchComponent]
[org.apache.solr.update.processor.UpdateRequestProcessorFactory]
[org.apache.solr.handler.component.ShardHandlerFactory]
I need this to allow cleanup of some cached items in the tokenizer.
Questions:
1: will a newer version allow me to do this directly?
2: is there some other approach that anyone would recommend? I could,
for example, make a fake object in the list above to act as a
singleton with a static accessor, but that seems pretty ugly.
Re: How can a Tokenizer be CoreAware?
Posted by bbarani <bb...@gmail.com>.
I am not an expert on this one but I would try doing this..I would implement
SolrCoreAware class and override inform method to make it core aware..
something like ...
public void inform( SolrCore core )
--
View this message in context: http://lucene.472066.n3.nabble.com/How-can-a-Tokenizer-be-CoreAware-tp4066735p4067377.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How can a Tokenizer be CoreAware?
Posted by Michael Sokolov <ms...@safaribooksonline.com>.
Benson, I think the idea is that Tokenizers are created as needed (from
the TokenizerFactory), while those other objects are singular (one
created for each corresponding stanza in solrconfig.xml). So Tokenizers
should be short-lived; they'll be cleaned up after each use, and the
assumption is you wouldn't need to do any cleanup yourself; rather just
let the garbage collector do its work -- assuming these are per-document
resources. But if you have longer-lived resources, maybe you could
manage them in the TokenizerFactory, which will be a singleton? Or in
UpdateRequestProcessFactory, like you suggested
-Mike
On 5/29/13 7:36 AM, Benson Margulies wrote:
> I am currently testing some things with Solr 4.0.0. I tried to make a
> tokenizer CoreAware, and was rewarded with:
>
> Caused by: org.apache.solr.common.SolrException: Invalid 'Aware'
> object: com.basistech.rlp.solr.RLPTokenizerFactory@19336006 --
> org.apache.solr.util.plugin.SolrCoreAware must be an instance of:
> [org.apache.solr.request.SolrRequestHandler]
> [org.apache.solr.response.QueryResponseWriter]
> [org.apache.solr.handler.component.SearchComponent]
> [org.apache.solr.update.processor.UpdateRequestProcessorFactory]
> [org.apache.solr.handler.component.ShardHandlerFactory]
>
> I need this to allow cleanup of some cached items in the tokenizer.
>
> Questions:
>
> 1: will a newer version allow me to do this directly?
> 2: is there some other approach that anyone would recommend? I could,
> for example, make a fake object in the list above to act as a
> singleton with a static accessor, but that seems pretty ugly.