Custom Analyzer Provider requires org.elasticsearch package


(John Chang) #1

I created a custom analyzer provider and plugged it into my elasticsearch.yml like this:
index:
analysis:
analyzer:
standard:
type: com.mycompany.server.services.index.MyCompanyAnalyzerProvider

When I start the node, I get:

Exception in thread "elasticsearch[Malice]clusterService#updateTask-pool-4-thread-1" org.elasticsearch.util.inject.CreationException: Guice creation errors:

  1. Error injecting constructor, org.elasticsearch.util.settings.SettingsException: Component [com.mycompany.server.services.index.MyCompanyAnalyzerProvider] does not start with prefix [org.elasticsearch]
    at org.elasticsearch.index.analysis.AnalysisService.(Unknown Source)

If I recompile the class so the package starts with org.elasticsearch, it starts with no error.
So, this isn't fatal, but I do find it surprising. I've had to obey interfaces to plug in classes, but never package names. Is this as intended? If so, I was curious what the purpose was?

As always, thanks for your time.

BTW -
In a previous post titled "How to set the anlyzer?" I could not get a custom analyzer provider to work; I figured that out (as you can see from context here), which lead to this post.


(Shay Banon) #2

Can you post your implementation? Basically, when you extend the
AbstractIndexComponent, it automatically tries and create component based
settings based on the prefix, the default prefix is "org.elasticsearch", you
should call a super with another parameter that includes your "company
prefix", for example: 'com.mycompany'.

-shay.banon

On Wed, Jun 9, 2010 at 2:42 AM, John Chang jchangkihtest2@gmail.com wrote:

I created a custom analyzer provider and plugged it into my
elasticsearch.yml
like this:
index:
analysis:
analyzer:
standard:
type: com.mycompany.server.services.index.MyCompanyAnalyzerProvider

When I start the node, I get:

Exception in thread
"elasticsearch[Malice]clusterService#updateTask-pool-4-thread-1"
org.elasticsearch.util.inject.CreationException: Guice creation errors:

  1. Error injecting constructor,
    org.elasticsearch.util.settings.SettingsException: Component
    [com.mycompany.server.services.index.MyCompanyAnalyzerProvider] does not
    start with prefix [org.elasticsearch]
    at org.elasticsearch.index.analysis.AnalysisService.(Unknown Source)

If I recompile the class so the package starts with org.elasticsearch, it
starts with no error.
So, this isn't fatal, but I do find it surprising. I've had to obey
interfaces to plug in classes, but never package names. Is this as
intended? If so, I was curious what the purpose was?

As always, thanks for your time.

BTW -
In a previous post titled "How to set the anlyzer?" I could not get a
custom
analyzer provider to work; I figured that out (as you can see from context
here), which lead to this post.

View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Custom-Analyzer-Provider-requires-org-elasticsearch-package-tp880872p880872.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(John Chang) #3

Here is my implementation <nabble_a href="KihaAnalyzerProvider.java">KihaAnalyzerProvider.java</nabble_a>


(system) #4