use of io.crate.metadata.IndexReference in project crate by crate.
the class DocIndexMetadataTest method testCompoundIndexColumn.
@Test
public void testCompoundIndexColumn() throws Exception {
DocIndexMetadata md = getDocIndexMetadataFromStatement("create table t (" + " id integer primary key," + " name string," + " fun string index off," + " INDEX fun_name_ft using fulltext(name, fun)" + ")");
assertThat(md.indices().size(), is(1));
assertThat(md.columns().size(), is(3));
assertThat(md.indices().get(ColumnIdent.fromPath("fun_name_ft")), instanceOf(IndexReference.class));
IndexReference indexInfo = md.indices().get(ColumnIdent.fromPath("fun_name_ft"));
assertThat(indexInfo.indexType(), is(Reference.IndexType.FULLTEXT));
assertThat(indexInfo.column().fqn(), is("fun_name_ft"));
}
use of io.crate.metadata.IndexReference in project crate by crate.
the class DocIndexMetadataTest method testCompoundIndexColumnNested.
@Test
public void testCompoundIndexColumnNested() throws Exception {
DocIndexMetadata md = getDocIndexMetadataFromStatement("create table t (" + " id integer primary key," + " name string," + " o object as (" + " fun string" + " )," + " INDEX fun_name_ft using fulltext(name, o['fun'])" + ")");
assertThat(md.indices().size(), is(1));
assertThat(md.columns().size(), is(3));
assertThat(md.indices().get(ColumnIdent.fromPath("fun_name_ft")), instanceOf(IndexReference.class));
IndexReference indexInfo = md.indices().get(ColumnIdent.fromPath("fun_name_ft"));
assertThat(indexInfo.indexType(), is(Reference.IndexType.FULLTEXT));
assertThat(indexInfo.column().fqn(), is("fun_name_ft"));
}
Aggregations