Skip to content

Commit 8adda49

Browse files
authored
Revert "Issues in Search Relevancy (#21841)" (#21853)
This reverts commit f388e57.
1 parent f388e57 commit 8adda49

File tree

16 files changed

+45
-571
lines changed

16 files changed

+45
-571
lines changed

ingestion/examples/sample_data/datasets/tables.json

Lines changed: 0 additions & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -32491,218 +32491,6 @@
3249132491
},
3249232492
"sourceUrl": "http://localhost:8080/test_long_description_table",
3249332493
"tags": []
32494-
},
32495-
{
32496-
"name": "ssot_utilization_detail",
32497-
"description": "A detail of each agent's time throughout the day. Individual events in each system are collapsed by aux_code, aux_channel, worktype_name, and reporting_date.",
32498-
"version": 0.5,
32499-
"updatedAt": 1638354087391,
32500-
"updatedBy": "anonymous",
32501-
"tableType": "Regular",
32502-
"columns": [
32503-
{
32504-
"name": "reporting_date",
32505-
"dataType": "DATE",
32506-
"dataTypeDisplay": "date",
32507-
"description": "The date the event began.",
32508-
"tags": [],
32509-
"ordinalPosition": 1
32510-
},
32511-
{
32512-
"name": "agent_id",
32513-
"dataType": "VARCHAR",
32514-
"dataLength": 100,
32515-
"dataTypeDisplay": "varchar",
32516-
"description": "The unique identifier for the agent from customer_success.remitly_employee.",
32517-
"tags": [],
32518-
"ordinalPosition": 2
32519-
},
32520-
{
32521-
"name": "agent_email",
32522-
"dataType": "VARCHAR",
32523-
"dataLength": 100,
32524-
"dataTypeDisplay": "varchar",
32525-
"description": "The agent email.",
32526-
"tags": [],
32527-
"ordinalPosition": 3
32528-
}
32529-
],
32530-
"database": {
32531-
"id": "50da1ff8-4e1d-4967-8931-45edbf4dd908",
32532-
"type": "database",
32533-
"name": "sample_data.ecommerce_db",
32534-
"description": "This **mock** database contains tables related to shopify sales and orders with related dimension tables.",
32535-
"href": "http://localhost:8585/api/v1/databases/50da1ff8-4e1d-4967-8931-45edbf4dd908"
32536-
},
32537-
"tags": [],
32538-
"usageSummary": {
32539-
"dailyStats": {
32540-
"count": 0,
32541-
"percentileRank": 0
32542-
},
32543-
"weeklyStats": {
32544-
"count": 0,
32545-
"percentileRank": 0
32546-
},
32547-
"monthlyStats": {
32548-
"count": 0,
32549-
"percentileRank": 0
32550-
},
32551-
"date": "2021-12-01"
32552-
},
32553-
"followers": []
32554-
},
32555-
{
32556-
"name": "itm_utilization_detail_login_events",
32557-
"description": "An intermediate table used to create ssot_utilization_detail. This table cleans up the \"CS Platform: login\" event dimensions to be congruent with downstream analytics.",
32558-
"version": 0.3,
32559-
"updatedAt": 1638354087391,
32560-
"updatedBy": "anonymous",
32561-
"tableType": "Regular",
32562-
"columns": [
32563-
{
32564-
"name": "reporting_date",
32565-
"dataType": "DATE",
32566-
"dataTypeDisplay": "date",
32567-
"description": "Event date",
32568-
"tags": [],
32569-
"ordinalPosition": 1
32570-
},
32571-
{
32572-
"name": "agent_id",
32573-
"dataType": "VARCHAR",
32574-
"dataLength": 100,
32575-
"dataTypeDisplay": "varchar",
32576-
"description": "Agent identifier",
32577-
"tags": [],
32578-
"ordinalPosition": 2
32579-
}
32580-
],
32581-
"database": {
32582-
"id": "50da1ff8-4e1d-4967-8931-45edbf4dd908",
32583-
"type": "database",
32584-
"name": "sample_data.ecommerce_db",
32585-
"description": "This **mock** database contains tables related to shopify sales and orders with related dimension tables.",
32586-
"href": "http://localhost:8585/api/v1/databases/50da1ff8-4e1d-4967-8931-45edbf4dd908"
32587-
},
32588-
"tags": [],
32589-
"usageSummary": {
32590-
"dailyStats": {
32591-
"count": 10,
32592-
"percentileRank": 30
32593-
},
32594-
"weeklyStats": {
32595-
"count": 50,
32596-
"percentileRank": 40
32597-
},
32598-
"monthlyStats": {
32599-
"count": 200,
32600-
"percentileRank": 50
32601-
},
32602-
"date": "2021-12-01"
32603-
},
32604-
"followers": []
32605-
},
32606-
{
32607-
"name": "customer_metrics_daily",
32608-
"description": "Daily customer metrics aggregated from various sources including ssot_utilization_detail and other operational tables.",
32609-
"version": 0.2,
32610-
"updatedAt": 1638354087391,
32611-
"updatedBy": "anonymous",
32612-
"tableType": "Regular",
32613-
"columns": [
32614-
{
32615-
"name": "metric_date",
32616-
"dataType": "DATE",
32617-
"dataTypeDisplay": "date",
32618-
"description": "Date of the metric",
32619-
"tags": [],
32620-
"ordinalPosition": 1
32621-
},
32622-
{
32623-
"name": "customer_count",
32624-
"dataType": "INT",
32625-
"dataTypeDisplay": "integer",
32626-
"description": "Total number of customers",
32627-
"tags": [],
32628-
"ordinalPosition": 2
32629-
}
32630-
],
32631-
"database": {
32632-
"id": "50da1ff8-4e1d-4967-8931-45edbf4dd908",
32633-
"type": "database",
32634-
"name": "sample_data.ecommerce_db",
32635-
"description": "This **mock** database contains tables related to shopify sales and orders with related dimension tables.",
32636-
"href": "http://localhost:8585/api/v1/databases/50da1ff8-4e1d-4967-8931-45edbf4dd908"
32637-
},
32638-
"tags": [],
32639-
"usageSummary": {
32640-
"dailyStats": {
32641-
"count": 100,
32642-
"percentileRank": 70
32643-
},
32644-
"weeklyStats": {
32645-
"count": 500,
32646-
"percentileRank": 80
32647-
},
32648-
"monthlyStats": {
32649-
"count": 2000,
32650-
"percentileRank": 90
32651-
},
32652-
"date": "2021-12-01"
32653-
},
32654-
"followers": []
32655-
},
32656-
{
32657-
"name": "agent_performance_summary",
32658-
"description": "Summary of agent performance metrics derived from multiple tables including ssot_utilization_detail for comprehensive reporting.",
32659-
"version": 0.4,
32660-
"updatedAt": 1638354087391,
32661-
"updatedBy": "anonymous",
32662-
"tableType": "Regular",
32663-
"columns": [
32664-
{
32665-
"name": "agent_id",
32666-
"dataType": "VARCHAR",
32667-
"dataLength": 100,
32668-
"dataTypeDisplay": "varchar",
32669-
"description": "Agent identifier",
32670-
"tags": [],
32671-
"ordinalPosition": 1
32672-
},
32673-
{
32674-
"name": "performance_score",
32675-
"dataType": "DECIMAL",
32676-
"dataTypeDisplay": "decimal",
32677-
"description": "Overall performance score",
32678-
"tags": [],
32679-
"ordinalPosition": 2
32680-
}
32681-
],
32682-
"database": {
32683-
"id": "50da1ff8-4e1d-4967-8931-45edbf4dd908",
32684-
"type": "database",
32685-
"name": "sample_data.ecommerce_db",
32686-
"description": "This **mock** database contains tables related to shopify sales and orders with related dimension tables.",
32687-
"href": "http://localhost:8585/api/v1/databases/50da1ff8-4e1d-4967-8931-45edbf4dd908"
32688-
},
32689-
"tags": [],
32690-
"usageSummary": {
32691-
"dailyStats": {
32692-
"count": 50,
32693-
"percentileRank": 60
32694-
},
32695-
"weeklyStats": {
32696-
"count": 250,
32697-
"percentileRank": 65
32698-
},
32699-
"monthlyStats": {
32700-
"count": 1000,
32701-
"percentileRank": 70
32702-
},
32703-
"date": "2021-12-01"
32704-
},
32705-
"followers": []
3270632494
}
3270732495
]
3270832496
}

openmetadata-service/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -948,12 +948,6 @@
948948
<artifactId>opensearch-rest-high-level-client</artifactId>
949949
<scope>test</scope>
950950
</dependency>
951-
<dependency>
952-
<groupId>org.open-metadata</groupId>
953-
<artifactId>opensearch-deps</artifactId>
954-
<version>1.8.0-SNAPSHOT</version>
955-
<scope>compile</scope>
956-
</dependency>
957951
</dependencies>
958952

959953
<profiles>

openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,6 @@ public interface SearchSourceBuilderFactory<S, Q, H, F> {
7272
* @return a search source builder configured for the specific entity type
7373
*/
7474
default S getSearchSourceBuilder(String index, String q, int from, int size) {
75-
return getSearchSourceBuilder(index, q, from, size, false);
76-
}
77-
78-
/**
79-
* Get the appropriate search source builder based on the index name.
80-
*
81-
* @param index the index name
82-
* @param q the search query
83-
* @param from the starting offset
84-
* @param size the number of results to return
85-
* @param explain whether to include explanation of the search results
86-
* @return a search source builder configured for the specific entity type
87-
*/
88-
default S getSearchSourceBuilder(String index, String q, int from, int size, boolean explain) {
8975
String indexName = Entity.getSearchRepository().getIndexNameWithoutAlias(index);
9076

9177
if (isTimeSeriesIndex(indexName)) {
@@ -101,7 +87,7 @@ default S getSearchSourceBuilder(String index, String q, int from, int size, boo
10187
}
10288

10389
if (isDataAssetIndex(indexName)) {
104-
return buildDataAssetSearchBuilder(indexName, q, from, size, explain);
90+
return buildDataAssetSearchBuilder(indexName, q, from, size);
10591
}
10692

10793
if (indexName.equals("all") || indexName.equals("dataAsset")) {
@@ -119,9 +105,6 @@ default S getSearchSourceBuilder(String index, String q, int from, int size, boo
119105

120106
S buildDataAssetSearchBuilder(String indexName, String query, int from, int size);
121107

122-
S buildDataAssetSearchBuilder(
123-
String indexName, String query, int from, int size, boolean explain);
124-
125108
S buildCommonSearchBuilder(String query, int from, int size);
126109

127110
S buildUserOrTeamSearchBuilder(String query, int from, int size);

openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,7 @@ public Response doSearch(
366366
new ElasticSearchSourceBuilderFactory(searchSettings);
367367
SearchSourceBuilder searchSourceBuilder =
368368
searchBuilderFactory.getSearchSourceBuilder(
369-
request.getIndex(),
370-
request.getQuery(),
371-
request.getFrom(),
372-
request.getSize(),
373-
request.getExplain());
369+
request.getIndex(), request.getQuery(), request.getFrom(), request.getSize());
374370

375371
buildSearchRBACQuery(subjectContext, searchSourceBuilder);
376372
// Add Filter

openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ public SearchSourceBuilder buildAggregateSearchBuilder(String query, int from, i
163163
@Override
164164
public SearchSourceBuilder buildDataAssetSearchBuilder(
165165
String indexName, String query, int from, int size) {
166-
return buildDataAssetSearchBuilder(indexName, query, from, size, false);
167-
}
168-
169-
@Override
170-
public SearchSourceBuilder buildDataAssetSearchBuilder(
171-
String indexName, String query, int from, int size, boolean explain) {
172166
AssetTypeConfiguration assetConfig = findAssetTypeConfig(indexName, searchSettings);
173167
Map<String, Float> fuzzyFields;
174168
Map<String, Float> nonFuzzyFields;
@@ -318,7 +312,7 @@ public SearchSourceBuilder buildDataAssetSearchBuilder(
318312
}
319313

320314
addConfiguredAggregations(searchSourceBuilder, assetConfig);
321-
searchSourceBuilder.explain(explain);
315+
searchSourceBuilder.explain(true);
322316
return searchSourceBuilder;
323317
}
324318

openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/SearchIndex.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import java.util.ArrayList;
2020
import java.util.Collections;
2121
import java.util.HashMap;
22+
import java.util.HashSet;
2223
import java.util.List;
2324
import java.util.Map;
2425
import java.util.Optional;
2526
import java.util.Set;
26-
import java.util.stream.Collectors;
2727
import org.apache.commons.lang3.tuple.ImmutablePair;
2828
import org.apache.commons.lang3.tuple.Pair;
2929
import org.openmetadata.schema.EntityInterface;
@@ -128,12 +128,29 @@ default Map<String, Object> getCommonAttributesMap(EntityInterface entity, Strin
128128
}
129129

130130
default Set<String> getFQNParts(String fqn) {
131-
var parts = FullyQualifiedName.split(fqn);
132-
var entityName = parts[parts.length - 1];
131+
Set<String> fqnParts = new HashSet<>();
132+
fqnParts.add(fqn);
133+
String parent = FullyQualifiedName.getParentFQN(fqn);
134+
while (parent != null) {
135+
fqnParts.add(parent);
136+
parent = FullyQualifiedName.getParentFQN(parent);
137+
}
138+
return fqnParts;
139+
}
133140

134-
return FullyQualifiedName.getAllParts(fqn).stream()
135-
.filter(part -> !part.equals(entityName))
136-
.collect(Collectors.toSet());
141+
// Add suggest inputs to fqnParts to support partial/wildcard search on names.
142+
// In some case of basic Test suite name is not part of the fullyQualifiedName, so it must be
143+
// added separately.
144+
default Set<String> getFQNParts(String fqn, List<String> fqnSplits) {
145+
Set<String> fqnParts = new HashSet<>();
146+
fqnParts.add(fqn);
147+
String parent = FullyQualifiedName.getParentFQN(fqn);
148+
while (parent != null) {
149+
fqnParts.add(parent);
150+
parent = FullyQualifiedName.getParentFQN(parent);
151+
}
152+
fqnParts.addAll(fqnSplits);
153+
return fqnParts;
137154
}
138155

139156
default List<EntityReference> getEntitiesWithDisplayName(List<EntityReference> entities) {

openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
import os.org.opensearch.action.get.GetRequest;
138138
import os.org.opensearch.action.get.GetResponse;
139139
import os.org.opensearch.action.search.SearchResponse;
140-
import os.org.opensearch.action.search.SearchType;
141140
import os.org.opensearch.action.support.WriteRequest;
142141
import os.org.opensearch.action.support.master.AcknowledgedResponse;
143142
import os.org.opensearch.action.update.UpdateRequest;
@@ -385,11 +384,7 @@ public Response doSearch(
385384
new OpenSearchSourceBuilderFactory(searchSettings);
386385
SearchSourceBuilder searchSourceBuilder =
387386
searchBuilderFactory.getSearchSourceBuilder(
388-
request.getIndex(),
389-
request.getQuery(),
390-
request.getFrom(),
391-
request.getSize(),
392-
request.getExplain());
387+
request.getIndex(), request.getQuery(), request.getFrom(), request.getSize());
393388

394389
buildSearchRBACQuery(subjectContext, searchSourceBuilder);
395390

@@ -514,10 +509,6 @@ public Response searchWithNLQ(SearchRequest request, SubjectContext subjectConte
514509
os.org.opensearch.action.search.SearchRequest searchRequest =
515510
new os.org.opensearch.action.search.SearchRequest(request.getIndex());
516511
searchRequest.source(searchSourceBuilder);
517-
518-
// Use DFS Query Then Fetch for consistent scoring across shards
519-
searchRequest.searchType(SearchType.DFS_QUERY_THEN_FETCH);
520-
521512
os.org.opensearch.action.search.SearchResponse response =
522513
client.search(searchRequest, os.org.opensearch.client.RequestOptions.DEFAULT);
523514
if (response.getHits() != null
@@ -550,10 +541,6 @@ private Response fallbackToBasicSearch(SearchRequest request, SubjectContext sub
550541
os.org.opensearch.action.search.SearchRequest osRequest =
551542
new os.org.opensearch.action.search.SearchRequest(request.getIndex());
552543
osRequest.source(searchSourceBuilder);
553-
554-
// Use DFS Query Then Fetch for consistent scoring across shards
555-
osRequest.searchType(SearchType.DFS_QUERY_THEN_FETCH);
556-
557544
getSearchBuilderFactory().addAggregationsToNLQQuery(searchSourceBuilder, request.getIndex());
558545
SearchResponse searchResponse = client.search(osRequest, OPENSEARCH_REQUEST_OPTIONS);
559546
return Response.status(Response.Status.OK).entity(searchResponse.toString()).build();

0 commit comments

Comments
 (0)