Skip to content

Commit

Permalink
remove author names (we no longer have them on) and fix header
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Dec 11, 2011
1 parent 44f9a2c commit 1901efb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
@@ -1,8 +1,8 @@
/*
* Licensed to Elastic Search and Shay Banon under one
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Expand All @@ -20,16 +20,17 @@
package org.elasticsearch.index.analysis;

/**
* @author kimchy (shay.banon)
*/
public class IcuAnalysisBinderProcessor extends AnalysisModule.AnalysisBinderProcessor {

@Override public void processTokenizers(TokenizersBindings tokenizersBindings) {
@Override
public void processTokenizers(TokenizersBindings tokenizersBindings) {
tokenizersBindings.processTokenizer("icuTokenizer", IcuTokenizerFactory.class);
tokenizersBindings.processTokenizer("icu_tokenizer", IcuTokenizerFactory.class);
}

@Override public void processTokenFilters(TokenFiltersBindings tokenFiltersBindings) {

@Override
public void processTokenFilters(TokenFiltersBindings tokenFiltersBindings) {
tokenFiltersBindings.processTokenFilter("icuNormalizer", IcuNormalizerTokenFilterFactory.class);
tokenFiltersBindings.processTokenFilter("icu_normalizer", IcuNormalizerTokenFilterFactory.class);

Expand Down
@@ -1,8 +1,8 @@
/*
* Licensed to Elastic Search and Shay Banon under one
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Expand All @@ -18,28 +18,28 @@
*/
package org.elasticsearch.index.analysis;

import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.assistedinject.Assisted;
import java.io.Reader;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.icu.segmentation.ICUTokenizer;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.assistedinject.Assisted;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.settings.IndexSettings;

import java.io.Reader;

/**
*
* @author joerg
*/
public class IcuTokenizerFactory extends AbstractTokenizerFactory {

@Inject public IcuTokenizerFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
@Inject
public IcuTokenizerFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
super(index, indexSettings, name, settings);
}

@Override
public Tokenizer create(Reader reader) {
return new ICUTokenizer(reader);
}

}
@@ -1,8 +1,8 @@
/*
* Licensed to Elastic Search and Shay Banon under one
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Expand All @@ -19,11 +19,11 @@

package org.elasticsearch.index.analysis;

import com.ibm.icu.text.Transliterator;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.icu.ICUTransformFilter;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.assistedinject.Assisted;
import com.ibm.icu.text.Transliterator;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.settings.IndexSettings;
Expand All @@ -38,15 +38,17 @@ public class IcuTransformTokenFilterFactory extends AbstractTokenFilterFactory {
private final int dir;
private final Transliterator transliterator;

@Inject public IcuTransformTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
@Inject
public IcuTransformTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
super(index, indexSettings, name, settings);
this.id = settings.get("id", "Null");
String s = settings.get("dir", "forward");
String s = settings.get("dir", "forward");
this.dir = "forward".equals(s) ? Transliterator.FORWARD : Transliterator.REVERSE;
this.transliterator = Transliterator.getInstance(id, dir);
}

@Override public TokenStream create(TokenStream tokenStream) {
@Override
public TokenStream create(TokenStream tokenStream) {
return new ICUTransformFilter(tokenStream, transliterator);
}
}
@@ -1,8 +1,8 @@
/*
* Licensed to Elastic Search and Shay Banon under one
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -32,15 +32,15 @@
import org.hamcrest.MatcherAssert;
import org.testng.annotations.Test;

import static org.elasticsearch.common.settings.ImmutableSettings.Builder.*;
import static org.hamcrest.Matchers.*;
import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS;
import static org.hamcrest.Matchers.instanceOf;

/**
* @author kimchy (shay.banon)
*/
public class SimpleIcuAnalysisTests {

@Test public void testDefaultsIcuAnalysis() {
@Test
public void testDefaultsIcuAnalysis() {
Index index = new Index("test");

Injector parentInjector = new ModulesBuilder().add(new SettingsModule(EMPTY_SETTINGS), new EnvironmentModule(new Environment(EMPTY_SETTINGS)), new IndicesAnalysisModule()).createInjector();
Expand All @@ -54,16 +54,16 @@ public class SimpleIcuAnalysisTests {

TokenizerFactory tokenizerFactory = analysisService.tokenizer("icu_tokenizer");
MatcherAssert.assertThat(tokenizerFactory, instanceOf(IcuTokenizerFactory.class));

TokenFilterFactory filterFactory = analysisService.tokenFilter("icu_normalizer");
MatcherAssert.assertThat(filterFactory, instanceOf(IcuNormalizerTokenFilterFactory.class));

filterFactory = analysisService.tokenFilter("icu_folding");
MatcherAssert.assertThat(filterFactory, instanceOf(IcuFoldingTokenFilterFactory.class));

filterFactory = analysisService.tokenFilter("icu_collation");
MatcherAssert.assertThat(filterFactory, instanceOf(IcuCollationTokenFilterFactory.class));

filterFactory = analysisService.tokenFilter("icu_transform");
MatcherAssert.assertThat(filterFactory, instanceOf(IcuTransformTokenFilterFactory.class));
}
Expand Down

0 comments on commit 1901efb

Please sign in to comment.