[ 
https://issues.apache.org/jira/browse/SOLR-4872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13681348#comment-13681348
 ] 

Benson Margulies commented on SOLR-4872:
----------------------------------------

I'm working with all of these classes, of course.

In the schema.xml, I have an analyzer element. It does not name an analyzer 
class, but rather a tokenizer class and some filters. Robert's comment suggests 
that the solution to my problem might be to subclass StandardAnalyzer to handle 
my closing needs instead of depending on the implicit use of it. Assuming, of 
course, that item #2 in Robert's list proves out.

My original request was to have CoreAware work for my TokenizerFactory, because 
I wanted to use ThreadLocals to keep around some per-core (or, if you prefer, 
per-schema) items that would live for the lifetime of a core.

There is no close protocol on TokenizerFactory. If there was one, all would be 
OK.

Solr TokenizerFactories don't return Analyzers, they return Tokenizers. 
Tokenizers have a close. So, in theory, I could work something off of the 
Tokenizer close method. Except, maybe, for LUCENE-2145, which reports that 
Tokenizer.close is not the last word in the lifetime of a Tokenizer. If Solr 
doesn't participate in that trick, I could still use it.

I honestly don't entirely understand why Ben, an ex-co-worker-of mine, dragged 
Analyzers into the picture in his remarks in LUCENE-2145. However, if he's 
right, and Tokenizer.close() amounts to Tokenizer.cleanUpReader(), I am left 
wishing over there that there was, a Tokenizer.reallyClose(). But that's a wish 
on LUCENE-2145.




                
> Allow analyzers to be SolrCoreAware
> -----------------------------------
>
>                 Key: SOLR-4872
>                 URL: https://issues.apache.org/jira/browse/SOLR-4872
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 4.3
>            Reporter: Benson Margulies
>
> I have a need, in an analyzer, to have a shared cache that is cleaned up when 
> the core is torn down. Solr rejects analyzer components that are 
> SolrCoreAware. Is there some really good reason for this? What harm would 
> come from allowing one to register a CloseHook?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to