Skip to content

Commit

Permalink
Merge branch 'master' of github.com:teiid/teiid
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Aug 23, 2018
2 parents 0f8f091 + 5a120e6 commit 1812e49
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Expand Up @@ -384,9 +384,15 @@ private Column addColumn(MetadataFactory mf,
c.setAnnotation(annotation);
}

if(annotation.contains("@IndexedField(index=false")) {
c.setSearchType(SearchType.Unsearchable);
}
String index = findFromAnnotation(AT_INDEXEDFIELD, annotation, "index");
if (index != null && (index.equalsIgnoreCase("false") || index.equalsIgnoreCase("no"))) {
c.setSearchType(SearchType.Unsearchable);
}

index = findFromAnnotation(AT_FIELD, annotation, "index");
if (index != null && (index.equalsIgnoreCase("Index.NO") || index.equalsIgnoreCase("no"))) {
c.setSearchType(SearchType.Unsearchable);
}

if(annotation.contains("@Id")) {
List<String> pkNames = new ArrayList<String>();
Expand All @@ -404,6 +410,8 @@ private Column addColumn(MetadataFactory mf,

private static final String AT_TEIID = "@Teiid("; //$NON-NLS-1$
private static final String AT_CACHE = "@Cache("; //$NON-NLS-1$
private static final String AT_INDEXEDFIELD = "@IndexedField("; //$NON-NLS-1$
private static final String AT_FIELD = "@Field("; //$NON-NLS-1$

private String findFromAnnotation(String rootProperty, String annotation, String verb) {
if ( annotation != null && !annotation.isEmpty()) {
Expand Down
Expand Up @@ -68,7 +68,7 @@ public void testConverstion() throws Exception {
" optional G3 g3 = 5;\n" +
" /* @IndexedField(index=false) */\n" +
" optional bytes e5 = 7;\n" +
" /* @Teiid(type=long) */\n" +
" /* @Field(index=Index.NO) */\n" +
" optional fixed64 e6 = 8;\n" +
" repeated G4 g4 = 6;\n" +
"}\n" +
Expand Down
Expand Up @@ -15,7 +15,7 @@ CREATE FOREIGN TABLE G2 (
g3_e1 integer NOT NULL OPTIONS (NAMEINSOURCE 'e1', SEARCHABLE 'Searchable', NATIVE_TYPE 'int32', "teiid_ispn:MESSAGE_NAME" 'pm1.G3', "teiid_ispn:PARENT_COLUMN_NAME" 'g3', "teiid_ispn:PARENT_TAG" '5', "teiid_ispn:TAG" '1'),
g3_e2 string NOT NULL OPTIONS (NAMEINSOURCE 'e2', SEARCHABLE 'Searchable', NATIVE_TYPE 'string', "teiid_ispn:MESSAGE_NAME" 'pm1.G3', "teiid_ispn:PARENT_COLUMN_NAME" 'g3', "teiid_ispn:PARENT_TAG" '5', "teiid_ispn:TAG" '2'),
e5 varbinary OPTIONS (ANNOTATION '@IndexedField(index=false)', SEARCHABLE 'Unsearchable', NATIVE_TYPE 'bytes', "teiid_ispn:TAG" '7'),
e6 long OPTIONS (SEARCHABLE 'Searchable', NATIVE_TYPE 'fixed64', "teiid_ispn:TAG" '8'),
e6 long OPTIONS (ANNOTATION '@Field(index=Index.NO)', SEARCHABLE 'Unsearchable', NATIVE_TYPE 'fixed64', "teiid_ispn:TAG" '8'),
CONSTRAINT PK_E1 PRIMARY KEY(e1)
) OPTIONS (ANNOTATION '@Indexed @Cache(name=default)', NAMEINSOURCE 'pm1.G2', UPDATABLE TRUE, "teiid_ispn:CACHE" 'default');

Expand Down
Expand Up @@ -29,6 +29,7 @@ message G2 {
repeated G4 g4 = 6;
/*@IndexedField(index=false) */
optional bytes e5 = 7;
/*@Field(index=Index.NO) */
optional fixed64 e6 = 8;
}

Expand Down

0 comments on commit 1812e49

Please sign in to comment.