Re: SolrCoreAware analyzer

2009-02-27 Thread Bojan Šmid
Thanks for you suggestions.

I do need SolrCore, but I could probably live with just SolrResourceLoader,
while also creating my own FieldType (which can be ResourceLoaderAware).

Bojan


On Thu, Feb 26, 2009 at 11:48 PM, Chris Hostetter
wrote:

>
> : I am writing a custom analyzer for my field type. This analyzer would
> need
> : to use SolrResourceLoader and SolrConfig, so I want to make it
> : SolrCoreAware.
>
> 1) Solr's support for using Analyzer instances is mainly just to make it
> easy for people who already have existing ANalyzer impls that they want to
> use -- if you're writing something new, i would suggest implementing the
> TokenizerFactory API.
>
> 2) Do you really need access to the SolrCore, or do you just need access
> to the SolrResourceLoader?  Because there is also the ResourceLoaderAware
> API.  If you take a look at StopFilterFactory you can see an example of
> how it's used.
>
> FWIW: The reasons Solr doesn't support SolrCoreAware Analysis related
> plugins (TokenizerFactory and TokenFilterFactory) are:
>
> a. it kept the initalization a lot simpler.  currently SOlrCore knows
> about the INdexSchema, but the IndexSchema doesnt' know anythng about the
> SolrCore.
> b. it allows for more reuse of the schema related code independent of the
> rest of Solr (there was talk at one point of promoting all of the
> IndexSchema/FieldType/Token*Factory code into a Lucene-Java contrib but
> so far no one has steped up to work out the refactoring)
>
>
> -Hoss
>
>


Re: SolrCoreAware analyzer

2009-02-26 Thread Chris Hostetter

: I am writing a custom analyzer for my field type. This analyzer would need
: to use SolrResourceLoader and SolrConfig, so I want to make it
: SolrCoreAware.

1) Solr's support for using Analyzer instances is mainly just to make it 
easy for people who already have existing ANalyzer impls that they want to 
use -- if you're writing something new, i would suggest implementing the 
TokenizerFactory API.

2) Do you really need access to the SolrCore, or do you just need access 
to the SolrResourceLoader?  Because there is also the ResourceLoaderAware 
API.  If you take a look at StopFilterFactory you can see an example of 
how it's used.

FWIW: The reasons Solr doesn't support SolrCoreAware Analysis related 
plugins (TokenizerFactory and TokenFilterFactory) are:

a. it kept the initalization a lot simpler.  currently SOlrCore knows 
about the INdexSchema, but the IndexSchema doesnt' know anythng about the 
SolrCore.
b. it allows for more reuse of the schema related code independent of the 
rest of Solr (there was talk at one point of promoting all of the 
IndexSchema/FieldType/Token*Factory code into a Lucene-Java contrib but 
so far no one has steped up to work out the refactoring)


-Hoss



SolrCoreAware analyzer

2009-02-26 Thread Bojan Šmid
Hello,

I am writing a custom analyzer for my field type. This analyzer would need
to use SolrResourceLoader and SolrConfig, so I want to make it
SolrCoreAware.

However, it seems that Analyzer classes aren't supposed to be used in this
way (as described in http://wiki.apache.org/solr/SolrPlugins). Is there any
way to provide my analyzer with SolrCore?

The list of valid SolrCoreAware classes is in SolrResourceLoader (line 465
on current Solr trunk), so I could create a patch (which would enable
Analyzers to get SolrCore) for my Solr instance, but I would rather avoid
making patches just for myself (just complicates maintenance).

Thanks in advance,

Bojan