add tests for path mappings

This commit is contained in:
kimchy 2010-05-14 12:26:41 +03:00
parent 911d800ff8
commit 04cfacec41
2 changed files with 26 additions and 7 deletions

View File

@ -42,12 +42,31 @@ public class PathXContentMapperTests {
assertThat(docMapper.mappers().indexName("first1"), notNullValue()); assertThat(docMapper.mappers().indexName("first1"), notNullValue());
assertThat(docMapper.mappers().indexName("name1.first1"), nullValue()); 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.last1"), nullValue());
assertThat(docMapper.mappers().indexName("name1.i_last_1"), nullValue());
assertThat(docMapper.mappers().indexName("first2"), nullValue()); assertThat(docMapper.mappers().indexName("first2"), nullValue());
assertThat(docMapper.mappers().indexName("name2.first2"), notNullValue()); assertThat(docMapper.mappers().indexName("name2.first2"), notNullValue());
assertThat(docMapper.mappers().indexName("last2"), nullValue()); 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());
} }
} }

View File

@ -5,18 +5,18 @@
"type" : "object", "type" : "object",
"path" : "just_name", "path" : "just_name",
"properties" : { "properties" : {
"first1" : {"type" : "string", "store" : "yes"}, "first1" : {"type" : "string"},
"last1" : {"type" : "string", "index" : "not_analyzed"} "last1" : {"type" : "string", "index_name" : "i_last_1"}
} }
}, },
"name2" : { "name2" : {
"type" : "object", "type" : "object",
"path" : "full", "path" : "full",
"properties" : { "properties" : {
"first2" : {"type" : "string", "store" : "yes"}, "first2" : {"type" : "string"},
"last2" : {"type" : "string", "index" : "not_analyzed"} "last2" : {"type" : "string", "index_name" : "i_last_2"}
} }
} }
} }
} }
} }