org.openmetadata.service.search.indexes.ClassificationIndex 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.classification.Classification;
import org.openmetadata.service.Entity;
import org.openmetadata.service.search.models.SearchSuggest;
public record ClassificationIndex(Classification classification) implements SearchIndex {
@Override
public List getSuggest() {
List suggest = new ArrayList<>();
suggest.add(SearchSuggest.builder().input(classification.getName()).weight(10).build());
suggest.add(
SearchSuggest.builder().input(classification.getFullyQualifiedName()).weight(5).build());
return suggest;
}
@Override
public Object getEntity() {
return classification;
}
public Map buildSearchIndexDocInternal(Map esDoc) {
Map commonAttributes =
getCommonAttributesMap(classification, Entity.CLASSIFICATION);
esDoc.putAll(commonAttributes);
return esDoc;
}
}