org.openmetadata.service.search.indexes.DatabaseSchemaIndex Maven / Gradle / Ivy
package org.openmetadata.service.search.indexes;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.openmetadata.schema.entity.data.DatabaseSchema;
import org.openmetadata.service.Entity;
import org.openmetadata.service.search.models.SearchSuggest;
public record DatabaseSchemaIndex(DatabaseSchema databaseSchema) implements SearchIndex {
public List getSuggest() {
List suggest = new ArrayList<>();
suggest.add(SearchSuggest.builder().input(databaseSchema.getName()).weight(5).build());
suggest.add(
SearchSuggest.builder().input(databaseSchema.getFullyQualifiedName()).weight(5).build());
return suggest;
}
@Override
public Object getEntity() {
return databaseSchema;
}
public Map buildSearchIndexDocInternal(Map doc) {
Map commonAttributes =
getCommonAttributesMap(databaseSchema, Entity.DATABASE_SCHEMA);
doc.putAll(commonAttributes);
return doc;
}
}