Search in sources :

Example 1 with IndexReference

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"));
}
Also used : IndexReference(io.crate.metadata.IndexReference) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) Test(org.junit.Test)

Example 2 with IndexReference

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"));
}
Also used : IndexReference(io.crate.metadata.IndexReference) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) Test(org.junit.Test)

Aggregations

IndexReference (io.crate.metadata.IndexReference)2 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)2 Test (org.junit.Test)2