Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mkamalas authored Aug 27, 2023
2 parents 2750e54 + 6bfd94c commit 15d56b1
Show file tree
Hide file tree
Showing 430 changed files with 6,194 additions and 1,390 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ metadata-ingestion/generated/**

# docs
docs/generated/
docs-website/versioned_docs/
tmp*
temp/**

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ Please follow the [DataHub Quickstart Guide](https://datahubproject.io/docs/quic

If you're looking to build & modify datahub please take a look at our [Development Guide](https://datahubproject.io/docs/developers).

[![DataHub Demo GIF](docs/imgs/entity.png)](https://demo.datahubproject.io/)
<p align="center">
<a href="https://demo.datahubproject.io/">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/entity.png"/>
</a>
</p>

## Source Code and Repositories

Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ buildscript {
ext.neo4jVersion = '4.4.9'
ext.testContainersVersion = '1.17.4'
ext.elasticsearchVersion = '7.10.2'
// TODO: Change to final release version once it's out ETA Mid-April
ext.jacksonVersion = '2.15.0-rc2'
ext.jacksonVersion = '2.15.2'
ext.jettyVersion = '9.4.46.v20220331'
ext.playVersion = '2.8.18'
ext.log4jVersion = '2.19.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import com.linkedin.datahub.graphql.generated.ListQueriesResult;
import com.linkedin.datahub.graphql.generated.ListTestsResult;
import com.linkedin.datahub.graphql.generated.ListViewsResult;
import com.linkedin.datahub.graphql.generated.MatchedField;
import com.linkedin.datahub.graphql.generated.MLFeature;
import com.linkedin.datahub.graphql.generated.MLFeatureProperties;
import com.linkedin.datahub.graphql.generated.MLFeatureTable;
Expand Down Expand Up @@ -1008,6 +1009,10 @@ private void configureGenericEntityResolvers(final RuntimeWiring.Builder builder
.dataFetcher("entity", new EntityTypeResolver(entityTypes,
(env) -> ((SearchResult) env.getSource()).getEntity()))
)
.type("MatchedField", typeWiring -> typeWiring
.dataFetcher("entity", new EntityTypeResolver(entityTypes,
(env) -> ((MatchedField) env.getSource()).getEntity()))
)
.type("SearchAcrossLineageResult", typeWiring -> typeWiring
.dataFetcher("entity", new EntityTypeResolver(entityTypes,
(env) -> ((SearchAcrossLineageResult) env.getSource()).getEntity()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.linkedin.datahub.graphql.generated.Privilege;
import com.linkedin.datahub.graphql.generated.QueriesTabConfig;
import com.linkedin.datahub.graphql.generated.ResourcePrivileges;
import com.linkedin.datahub.graphql.generated.SearchResultsVisualConfig;
import com.linkedin.datahub.graphql.generated.TelemetryConfig;
import com.linkedin.datahub.graphql.generated.TestsConfig;
import com.linkedin.datahub.graphql.generated.ViewsConfig;
Expand Down Expand Up @@ -144,6 +145,13 @@ public CompletableFuture<AppConfig> get(final DataFetchingEnvironment environmen
}
visualConfig.setEntityProfiles(entityProfilesConfig);
}
if (_visualConfiguration != null && _visualConfiguration.getSearchResult() != null) {
SearchResultsVisualConfig searchResultsVisualConfig = new SearchResultsVisualConfig();
if (_visualConfiguration.getSearchResult().getEnableNameHighlight() != null) {
searchResultsVisualConfig.setEnableNameHighlight(_visualConfiguration.getSearchResult().getEnableNameHighlight());
}
visualConfig.setSearchResult(searchResultsVisualConfig);
}
appConfig.setVisualConfig(visualConfig);

final TelemetryConfig telemetryConfig = new TelemetryConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public com.linkedin.metadata.query.SearchFlags apply(@Nonnull final SearchFlags
if (searchFlags.getSkipAggregates() != null) {
result.setSkipAggregates(searchFlags.getSkipAggregates());
}
if (searchFlags.getGetSuggestions() != null) {
result.setGetSuggestions(searchFlags.getGetSuggestions());
}
return result;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.linkedin.datahub.graphql.types.mappers;

import com.linkedin.common.urn.Urn;
import com.linkedin.datahub.graphql.generated.AggregationMetadata;
import com.linkedin.datahub.graphql.generated.FacetMetadata;
import com.linkedin.datahub.graphql.generated.MatchedField;
import com.linkedin.datahub.graphql.generated.SearchResult;
import com.linkedin.datahub.graphql.generated.SearchSuggestion;
import com.linkedin.datahub.graphql.resolvers.EntityTypeMapper;
import com.linkedin.datahub.graphql.types.common.mappers.UrnToEntityMapper;
import com.linkedin.metadata.search.SearchEntity;
import com.linkedin.metadata.search.utils.SearchUtils;
import lombok.extern.slf4j.Slf4j;

import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
Expand All @@ -16,6 +22,7 @@
import static com.linkedin.metadata.utils.SearchUtil.*;


@Slf4j
public class MapperUtils {

private MapperUtils() {
Expand Down Expand Up @@ -54,7 +61,24 @@ public static String convertFilterValue(String filterValue, List<Boolean> isEnti

public static List<MatchedField> getMatchedFieldEntry(List<com.linkedin.metadata.search.MatchedField> highlightMetadata) {
return highlightMetadata.stream()
.map(field -> new MatchedField(field.getName(), field.getValue()))
.map(field -> {
MatchedField matchedField = new MatchedField();
matchedField.setName(field.getName());
matchedField.setValue(field.getValue());
if (SearchUtils.isUrn(field.getValue())) {
try {
Urn urn = Urn.createFromString(field.getValue());
matchedField.setEntity(UrnToEntityMapper.map(urn));
} catch (URISyntaxException e) {
log.warn("Failed to create urn from MatchedField value: {}", field.getValue(), e);
}
}
return matchedField;
})
.collect(Collectors.toList());
}

public static SearchSuggestion mapSearchSuggestion(com.linkedin.metadata.search.SearchSuggestion suggestion) {
return new SearchSuggestion(suggestion.getText(), suggestion.getScore(), Math.toIntExact(suggestion.getFrequency()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public SearchResults apply(com.linkedin.metadata.search.SearchResult input) {
final SearchResultMetadata searchResultMetadata = input.getMetadata();
result.setSearchResults(input.getEntities().stream().map(MapperUtils::mapResult).collect(Collectors.toList()));
result.setFacets(searchResultMetadata.getAggregations().stream().map(MapperUtils::mapFacet).collect(Collectors.toList()));
result.setSuggestions(searchResultMetadata.getSuggestions().stream().map(MapperUtils::mapSearchSuggestion).collect(Collectors.toList()));

return result;
}
Expand Down
15 changes: 15 additions & 0 deletions datahub-graphql-core/src/main/resources/app.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ type VisualConfig {
Configuration for the queries tab
"""
entityProfiles: EntityProfilesConfig

"""
Configuration for search results
"""
searchResult: SearchResultsVisualConfig
}

"""
Expand Down Expand Up @@ -255,6 +260,16 @@ type EntityProfileConfig {
defaultTab: String
}

"""
Configuration for a search result
"""
type SearchResultsVisualConfig {
"""
Whether a search result should highlight the name/description if it was matched on those fields.
"""
enableNameHighlight: Boolean
}

"""
Configurations related to tracking users in the app
"""
Expand Down
40 changes: 40 additions & 0 deletions datahub-graphql-core/src/main/resources/search.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ input SearchFlags {
Whether to skip aggregates/facets
"""
skipAggregates: Boolean

"""
Whether to request for search suggestions on the _entityName virtualized field
"""
getSuggestions: Boolean
}

"""
Expand Down Expand Up @@ -483,6 +488,11 @@ type SearchResults {
Candidate facet aggregations used for search filtering
"""
facets: [FacetMetadata!]

"""
Search suggestions based on the query provided for alternate query texts
"""
suggestions: [SearchSuggestion!]
}

"""
Expand Down Expand Up @@ -665,6 +675,11 @@ type MatchedField {
Value of the field that matched
"""
value: String!

"""
Entity if the value is an urn
"""
entity: Entity
}

"""
Expand Down Expand Up @@ -722,6 +737,31 @@ type AggregationMetadata {
entity: Entity
}

"""
A suggestion for an alternate search query given an original query compared to all
of the entity names in our search index.
"""
type SearchSuggestion {
"""
The suggested text based on the provided query text compared to
the entity name field in the search index.
"""
text: String!

"""
The "edit distance" for this suggestion. The closer this number is to 1, the
closer the suggested text is to the original text. The closer it is to 0, the
further from the original text it is.
"""
score: Float

"""
The number of entities that would match on the name field given the suggested text
"""
frequency: Int
}


"""
Input for performing an auto completion query against a single Metadata Entity
"""
Expand Down
4 changes: 3 additions & 1 deletion datahub-web-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ for functional configurability should reside.
to render a view associated with a particular entity type (user, dataset, etc.).


![entity-registry](./entity-registry.png)
<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/entity-registry.png"/>
</p>

**graphql** - The React App talks to the `dathub-frontend` server using GraphQL. This module is where the *queries* issued
against the server are defined. Once defined, running `yarn run generate` will code-gen TypeScript objects to make invoking
Expand Down
Loading

0 comments on commit 15d56b1

Please sign in to comment.