/*
 * Licensed to Elastic Search 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
 * 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
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.elasticsearch.index.analysis;

import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.TokenStream;
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;

/**
 * @author kimchy (Shay Banon)
 */
public class LowerCaseTokenFilterFactory extends AbstractTokenFilterFactory {

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

    @Override public TokenStream create(TokenStream tokenStream) {
        return new LowerCaseFilter(version, tokenStream);
    }
}



@@ -943,16 +943,200 @@
 Stream;%0A
+import org.apache.lucene.analysis.el.GreekLowerCaseFilter;%0Aimport org.apache.lucene.analysis.tr.TurkishLowerCaseFilter;%0Aimport org.elasticsearch.ElasticSearchIllegalArgumentException;%0A
 import o
@@ -1174,16 +1174,16 @@
 Inject;%0A
-
 import o
@@ -1501,16 +1501,48 @@
 tory %7B%0A%0A
+    private final String lang;%0A%0A
     @Inj
@@ -1739,16 +1739,68 @@
 tings);%0A
+        this.lang = settings.get(%22language%22, null);%0A
     %7D%0A%0A 
@@ -1861,24 +1861,56 @@
 enStream) %7B%0A
+        if (lang == null) %7B%0A    
         retu
@@ -1955,16 +1955,393 @@
 tream);%0A
+        %7D else if (lang.equalsIgnoreCase(%22greek%22)) %7B%0A            return new GreekLowerCaseFilter(version, tokenStream);%0A        %7D else if (lang.equalsIgnoreCase(%22turkish%22)) %7B%0A            return new TurkishLowerCaseFilter(tokenStream);%0A        %7D else %7B%0A            throw new ElasticSearchIllegalArgumentException(%22language %5B%22 + lang + %22%5D not support for lower case%22);%0A        %7D%0A
     %7D%0A%7D%0A

Add language setting to lowercase filter, supporting greek and turkish, closes #1503.