From 04cfacec41f04060fa192ef5021f7eab0394c233 Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 14 May 2010 12:26:41 +0300 Subject: [PATCH] add tests for path mappings --- .../path/PathXContentMapperTests.java | 23 +++++++++++++++++-- .../mapper/xcontent/path/test-mapping.json | 10 ++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java index e7cbc252b48..03d57df533c 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java @@ -42,12 +42,31 @@ public class PathXContentMapperTests { assertThat(docMapper.mappers().indexName("first1"), notNullValue()); assertThat(docMapper.mappers().indexName("name1.first1"), nullValue()); - assertThat(docMapper.mappers().indexName("last1"), notNullValue()); + assertThat(docMapper.mappers().indexName("last1"), nullValue()); + assertThat(docMapper.mappers().indexName("i_last_1"), notNullValue()); assertThat(docMapper.mappers().indexName("name1.last1"), nullValue()); + assertThat(docMapper.mappers().indexName("name1.i_last_1"), nullValue()); assertThat(docMapper.mappers().indexName("first2"), nullValue()); assertThat(docMapper.mappers().indexName("name2.first2"), notNullValue()); assertThat(docMapper.mappers().indexName("last2"), nullValue()); - assertThat(docMapper.mappers().indexName("name2.last2"), notNullValue()); + assertThat(docMapper.mappers().indexName("i_last_2"), nullValue()); + assertThat(docMapper.mappers().indexName("name2.i_last_2"), notNullValue()); + assertThat(docMapper.mappers().indexName("name2.last2"), nullValue()); + + // test full name + assertThat(docMapper.mappers().fullName("first1"), nullValue()); + assertThat(docMapper.mappers().fullName("name1.first1"), notNullValue()); + assertThat(docMapper.mappers().fullName("last1"), nullValue()); + assertThat(docMapper.mappers().fullName("i_last_1"), nullValue()); + assertThat(docMapper.mappers().fullName("name1.last1"), notNullValue()); + assertThat(docMapper.mappers().fullName("name1.i_last_1"), nullValue()); + + assertThat(docMapper.mappers().fullName("first2"), nullValue()); + assertThat(docMapper.mappers().fullName("name2.first2"), notNullValue()); + assertThat(docMapper.mappers().fullName("last2"), nullValue()); + assertThat(docMapper.mappers().fullName("i_last_2"), nullValue()); + assertThat(docMapper.mappers().fullName("name2.i_last_2"), nullValue()); + assertThat(docMapper.mappers().fullName("name2.last2"), notNullValue()); } } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/test-mapping.json b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/test-mapping.json index 994a6b7b786..8b4b554c7c2 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/test-mapping.json +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/test-mapping.json @@ -5,18 +5,18 @@ "type" : "object", "path" : "just_name", "properties" : { - "first1" : {"type" : "string", "store" : "yes"}, - "last1" : {"type" : "string", "index" : "not_analyzed"} + "first1" : {"type" : "string"}, + "last1" : {"type" : "string", "index_name" : "i_last_1"} } }, "name2" : { "type" : "object", "path" : "full", "properties" : { - "first2" : {"type" : "string", "store" : "yes"}, - "last2" : {"type" : "string", "index" : "not_analyzed"} + "first2" : {"type" : "string"}, + "last2" : {"type" : "string", "index_name" : "i_last_2"} } } } } -} \ No newline at end of file +}