@@ -0,0 +1,2875 @@
+package org.elasticsearch.index.analysis;%0A%0A/**%0A * @author duydo%0A */%0A%0Aimport org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;%0Aimport org.elasticsearch.action.search.SearchResponse;%0Aimport org.elasticsearch.common.settings.ImmutableSettings;%0Aimport org.elasticsearch.common.settings.Settings;%0Aimport org.elasticsearch.common.xcontent.XContentBuilder;%0Aimport org.elasticsearch.index.query.QueryBuilders;%0Aimport org.elasticsearch.plugins.PluginsService;%0Aimport org.elasticsearch.test.ElasticsearchIntegrationTest;%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException;%0Aimport java.util.concurrent.ExecutionException;%0A%0Aimport static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.hamcrest.CoreMatchers.notNullValue;%0A%0A@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE)%0Apublic class VietnameseAnalysisIntegrationTest extends ElasticsearchIntegrationTest %7B%0A    @Override%0A    protected Settings nodeSettings(int nodeOrdinal) %7B%0A        return ImmutableSettings.builder()%0A                .put(super.nodeSettings(nodeOrdinal))%0A                .put(%22plugins.%22 + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)%0A                .build();%0A    %7D%0A%0A    @Test%0A    public void testVietnameseAnalyzer() throws ExecutionException, InterruptedException %7B%0A        AnalyzeResponse response = client().admin().indices()%0A                .prepareAnalyze(%22c%C3%B4ng ngh%E1%BB%87 th%C3%B4ng tin Vi%E1%BB%87t Nam%22).setAnalyzer(%22vi_analyzer%22)%0A                .execute().get();%0A        String%5B%5D expected = %7B%22c%C3%B4ng ngh%E1%BB%87 th%C3%B4ng tin%22, %22vi%E1%BB%87t nam%22%7D;%0A        assertThat(response, notNullValue());%0A        assertThat(response.getTokens().size(), is(2));%0A        for (int i = 0; i %3C expected.length; i++) %7B%0A            assertThat(response.getTokens().get(i).getTerm(), is(expected%5Bi%5D));%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testVietnameseAnalyzerInMapping() throws ExecutionException, InterruptedException, IOException %7B%0A        createIndex(%22test%22);%0A        ensureGreen(%22test%22);%0A        final XContentBuilder mapping = jsonBuilder().startObject()%0A                .startObject(%22type%22)%0A                .startObject(%22properties%22)%0A                .startObject(%22foo%22)%0A                .field(%22type%22, %22string%22)%0A                .field(%22analyzer%22, %22vi_analyzer%22)%0A                .endObject()%0A                .endObject()%0A                .endObject()%0A                .endObject();%0A        client().admin().indices().preparePutMapping(%22test%22).setType(%22type%22).setSource(mapping).get();%0A        index(%22test%22, %22type%22, %221%22, %22foo%22, %22c%C3%B4ng ngh%E1%BB%87 th%C3%B4ng tin Vi%E1%BB%87t Nam%22);%0A        refresh();%0A        SearchResponse response = client().prepareSearch(%22test%22).setQuery(%0A                QueryBuilders.matchQuery(%22foo%22, %22Vi%E1%BB%87t Nam%22)%0A        ).execute().actionGet();%0A        assertThat(response.getHits().getTotalHits(), is(1L));%0A    %7D%0A%7D

add integration test