Adding analyzers


(Paul Loy) #1

Using these index settings:

{
"analysis":{
"analyzer":{
"title":{
"type":"standard"
},
"en_title":{
"type":"org.apache.lucene.analysis.en.EnglishAnalyzer"
},
"cjk_title":{
"type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"
}
}
}
}

Causes this:

  1. Could not find a suitable constructor in
    org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one
    (and only one) constructor annotated with @Inject or a zero-argument
    constructor that is not private.
    at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)
    at
    org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at
    org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at
    org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

  2. Could not find a suitable constructor in
    org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one
    (and only one) constructor annotated with @Inject or a zero-argument
    constructor that is not private.
    at
    org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)
    at
    org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at
    org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at
    org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

I suppose I could just wrap the analyzers myself to make them work, but
thought I'd see what your suggestion may be.

Thanks.

Paul.


Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy


(Shay Banon) #2

For custom analyzers, then you need to wrap it youself with an elasticsearch analyzer factory that creates them. But, those specific analyzers are already exposed in elasticsearch (the english on in 0.16.1, though its just a porter stemmer if memory serves).
On Saturday, May 7, 2011 at 4:37 AM, Paul Loy wrote:

Using these index settings:

{
"analysis":{
"analyzer":{
"title":{
"type":"standard"
},
"en_title":{
"type":"org.apache.lucene.analysis.en.EnglishAnalyzer"
},
"cjk_title":{
"type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"
}
}
}
}

Causes this:

  1. Could not find a suitable constructor in org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)
    at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

  2. Could not find a suitable constructor in org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)
    at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

I suppose I could just wrap the analyzers myself to make them work, but thought I'd see what your suggestion may be.

Thanks.

Paul.


Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy


(Paul Loy) #3

I think you're correct about the PorterStemmer, however the SnowBallAnalyzer
is deprecated so don't know what option I have.

On Sat, May 7, 2011 at 8:16 AM, Shay Banon shay.banon@elasticsearch.comwrote:

For custom analyzers, then you need to wrap it youself with an
elasticsearch analyzer factory that creates them. But, those specific
analyzers are already exposed in elasticsearch (the english on in 0.16.1,
though its just a porter stemmer if memory serves).

On Saturday, May 7, 2011 at 4:37 AM, Paul Loy wrote:

Using these index settings:

{
"analysis":{
"analyzer":{
"title":{
"type":"standard"
},
"en_title":{
"type":"org.apache.lucene.analysis.en.EnglishAnalyzer"
},
"cjk_title":{
"type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"
}
}
}
}

Causes this:

  1. Could not find a suitable constructor in
    org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one
    (and only one) constructor annotated with @Inject or a zero-argument
    constructor that is not private.
    at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)
    at
    org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at
    org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at
    org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

  2. Could not find a suitable constructor in
    org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one
    (and only one) constructor annotated with @Inject or a zero-argument
    constructor that is not private.
    at
    org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)
    at
    org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at
    org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at
    org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

I suppose I could just wrap the analyzers myself to make them work, but
thought I'd see what your suggestion may be.

Thanks.

Paul.


Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy

--

Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy


(Shay Banon) #4

Its deprecated for the specific language analysis analyzers. In 0.16, you have cjk (for the CJKAnalyzer), and in upcoming 0.16.1 you also have english for the EnglishAnalyzer. cjk and english are similar to standard, you can just start using them in your mappings.
On Sunday, May 8, 2011 at 1:40 AM, Paul Loy wrote:

I think you're correct about the PorterStemmer, however the SnowBallAnalyzer is deprecated so don't know what option I have.

On Sat, May 7, 2011 at 8:16 AM, Shay Banon shay.banon@elasticsearch.com wrote:

For custom analyzers, then you need to wrap it youself with an elasticsearch analyzer factory that creates them. But, those specific analyzers are already exposed in elasticsearch (the english on in 0.16.1, though its just a porter stemmer if memory serves).
On Saturday, May 7, 2011 at 4:37 AM, Paul Loy wrote:

Using these index settings:

{
"analysis":{
"analyzer":{
"title":{
"type":"standard"
},
"en_title":{
"type":"org.apache.lucene.analysis.en.EnglishAnalyzer"
},
"cjk_title":{
"type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"
}
}
}
}

Causes this:

  1. Could not find a suitable constructor in org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)
    at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

  2. Could not find a suitable constructor in org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)
    at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)
    at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)
    at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

I suppose I could just wrap the analyzers myself to make them work, but thought I'd see what your suggestion may be.

Thanks.

Paul.


Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy

--

Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy


(system) #5