mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-08 13:36:32 +00:00
* Fix #1681 - Deleted Filter in Automations Not Working as Expected * Revert "Fix #1681 - Deleted Filter in Automations Not Working as Expected" This reverts commit d941ad440b6c5bcb66d4ac8bb31c321fb23cbcfc. * Set deleted param in /search/query API to type Boolean to allow default null values * fix AUT test failures related to user search in settings/users page * fix AUT test failures related to user search in settings/users page * Make `deleted` param optional for search API call in explore page * Fix the deleted users showing on the user listing page after user search * Fix playwright tests * Fix playwright tests --------- Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> (cherry picked from commit 4143308f96a587265f6599f2ec07d37e08fc8665)
This commit is contained in:
parent
623a09dc94
commit
908c03e5c9
@ -114,10 +114,9 @@ public class SearchResource {
|
||||
@QueryParam("index")
|
||||
String index,
|
||||
@Parameter(description = "Filter documents by deleted param. By default deleted is false")
|
||||
@DefaultValue("false")
|
||||
@QueryParam("deleted")
|
||||
@Deprecated(forRemoval = true)
|
||||
boolean deleted,
|
||||
Boolean deleted,
|
||||
@Parameter(description = "From field to paginate the results, defaults to 0")
|
||||
@DefaultValue("0")
|
||||
@QueryParam("from")
|
||||
|
||||
@ -42,6 +42,25 @@ public interface SearchSourceBuilderFactory<S, Q, H, F> {
|
||||
"[+\\-~\\^]" // Special operators
|
||||
);
|
||||
|
||||
Set<String> FUZZY_FIELDS =
|
||||
Set.of(
|
||||
"name",
|
||||
"displayName",
|
||||
"fullyQualifiedName",
|
||||
"columnNamesFuzzy",
|
||||
"fieldNamesFuzzy",
|
||||
"response_field_namesFuzzy",
|
||||
"request_field_namesFuzzy",
|
||||
"classification.name",
|
||||
"classification.displayName",
|
||||
"glossary.name",
|
||||
"glossary.displayName");
|
||||
|
||||
// Keyword fields added to fuzzy because Lucene needs keyword fields for wildcard/prefix queries
|
||||
// in query_string
|
||||
Set<String> FUZZY_AND_NON_FUZZY_FIELDS =
|
||||
Set.of("name.keyword", "displayName.keyword", "fullyQualifiedName.keyword");
|
||||
|
||||
/**
|
||||
* Get the appropriate search source builder based on the index name.
|
||||
*
|
||||
@ -236,18 +255,16 @@ public interface SearchSourceBuilderFactory<S, Q, H, F> {
|
||||
}
|
||||
|
||||
default boolean isFuzzyField(String key) {
|
||||
return Set.of(
|
||||
"name",
|
||||
"displayName",
|
||||
"fullyQualifiedName",
|
||||
"columnNamesFuzzy",
|
||||
"fieldNamesFuzzy",
|
||||
"response_field_namesFuzzy",
|
||||
"request_field_namesFuzzy",
|
||||
"classification.name",
|
||||
"classification.displayName",
|
||||
"glossary.name",
|
||||
"glossary.displayName")
|
||||
.contains(key);
|
||||
if (FUZZY_AND_NON_FUZZY_FIELDS.contains(key)) {
|
||||
return true;
|
||||
}
|
||||
return FUZZY_FIELDS.contains(key);
|
||||
}
|
||||
|
||||
default boolean isNonFuzzyField(String key) {
|
||||
if (FUZZY_AND_NON_FUZZY_FIELDS.contains(key)) {
|
||||
return true;
|
||||
}
|
||||
return !FUZZY_FIELDS.contains(key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,12 +3,8 @@ package org.openmetadata.service.search.elasticsearch;
|
||||
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
|
||||
import static javax.ws.rs.core.Response.Status.OK;
|
||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
|
||||
import static org.openmetadata.service.Entity.AGGREGATED_COST_ANALYSIS_REPORT_DATA;
|
||||
import static org.openmetadata.service.Entity.DATA_PRODUCT;
|
||||
import static org.openmetadata.service.Entity.DOMAIN;
|
||||
import static org.openmetadata.service.Entity.GLOSSARY_TERM;
|
||||
import static org.openmetadata.service.Entity.QUERY;
|
||||
import static org.openmetadata.service.Entity.RAW_COST_ANALYSIS_REPORT_DATA;
|
||||
import static org.openmetadata.service.Entity.TABLE;
|
||||
import static org.openmetadata.service.events.scheduled.ServicesStatusJobHandler.HEALTHY_STATUS;
|
||||
import static org.openmetadata.service.events.scheduled.ServicesStatusJobHandler.UNHEALTHY_STATUS;
|
||||
@ -365,6 +361,7 @@ public class ElasticSearchClient implements SearchClient {
|
||||
public Response doSearch(
|
||||
SearchRequest request, SubjectContext subjectContext, SearchSettings searchSettings)
|
||||
throws IOException {
|
||||
String indexName = Entity.getSearchRepository().getIndexNameWithoutAlias(request.getIndex());
|
||||
ElasticSearchSourceBuilderFactory searchBuilderFactory =
|
||||
new ElasticSearchSourceBuilderFactory(searchSettings);
|
||||
SearchSourceBuilder searchSourceBuilder =
|
||||
@ -396,60 +393,26 @@ public class ElasticSearchClient implements SearchClient {
|
||||
}
|
||||
|
||||
/* For backward-compatibility we continue supporting the deleted argument, this should be removed in future versions */
|
||||
if (request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(Entity.getSearchRepository().getIndexOrAliasName(GLOBAL_SEARCH_ALIAS))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(Entity.getSearchRepository().getIndexOrAliasName("dataAsset"))) {
|
||||
es.org.elasticsearch.index.query.BoolQueryBuilder boolQueryBuilder =
|
||||
QueryBuilders.boolQuery();
|
||||
boolQueryBuilder.should(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.must(QueryBuilders.existsQuery("deleted"))
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())));
|
||||
boolQueryBuilder.should(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.mustNot(QueryBuilders.existsQuery("deleted")));
|
||||
searchSourceBuilder.query(boolQueryBuilder);
|
||||
} else if (request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository().getIndexMapping(DOMAIN).getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository()
|
||||
.getIndexMapping(DATA_PRODUCT)
|
||||
.getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository().getIndexMapping(QUERY).getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository().getIndexOrAliasName("knowledge_page_search_index"))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository()
|
||||
.getIndexMapping(RAW_COST_ANALYSIS_REPORT_DATA)
|
||||
.getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository()
|
||||
.getIndexMapping(AGGREGATED_COST_ANALYSIS_REPORT_DATA)
|
||||
.getIndexName(clusterAlias))) {
|
||||
searchSourceBuilder.query(QueryBuilders.boolQuery().must(searchSourceBuilder.query()));
|
||||
} else {
|
||||
searchSourceBuilder.query(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())));
|
||||
if (!nullOrEmpty(request.getDeleted())) {
|
||||
if (indexName.equals(GLOBAL_SEARCH_ALIAS) || indexName.equals(DATA_ASSET_SEARCH_ALIAS)) {
|
||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||
|
||||
boolQueryBuilder.should(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.must(QueryBuilders.existsQuery("deleted"))
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())));
|
||||
boolQueryBuilder.should(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.mustNot(QueryBuilders.existsQuery("deleted")));
|
||||
searchSourceBuilder.query(boolQueryBuilder);
|
||||
} else {
|
||||
searchSourceBuilder.query(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())));
|
||||
}
|
||||
}
|
||||
|
||||
if (!nullOrEmpty(request.getSortFieldParam()) && !request.getIsHierarchy()) {
|
||||
|
||||
@ -55,7 +55,7 @@ public class ElasticSearchSourceBuilderFactory
|
||||
|
||||
Map<String, Float> nonFuzzyFields =
|
||||
fields.entrySet().stream()
|
||||
.filter(entry -> !isFuzzyField(entry.getKey()))
|
||||
.filter(entry -> isNonFuzzyField(entry.getKey()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
QueryStringQueryBuilder fuzzyQueryBuilder =
|
||||
@ -174,7 +174,7 @@ public class ElasticSearchSourceBuilderFactory
|
||||
.collect(Collectors.toMap(FieldBoost::getField, fb -> fb.getBoost().floatValue()));
|
||||
nonFuzzyFields =
|
||||
assetConfig.getSearchFields().stream()
|
||||
.filter(fieldBoost -> !isFuzzyField(fieldBoost.getField()))
|
||||
.filter(fieldBoost -> isNonFuzzyField(fieldBoost.getField()))
|
||||
.collect(Collectors.toMap(FieldBoost::getField, fb -> fb.getBoost().floatValue()));
|
||||
} else {
|
||||
Map<String, Float> defaultFields = SearchIndex.getDefaultFields();
|
||||
@ -184,7 +184,7 @@ public class ElasticSearchSourceBuilderFactory
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
nonFuzzyFields =
|
||||
defaultFields.entrySet().stream()
|
||||
.filter(entry -> !isFuzzyField(entry.getKey()))
|
||||
.filter(entry -> isNonFuzzyField(entry.getKey()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ import static org.openmetadata.service.search.EntityBuilderConstant.FIELD_DISPLA
|
||||
import static org.openmetadata.service.search.EntityBuilderConstant.FIELD_NAME_NGRAM;
|
||||
import static org.openmetadata.service.search.EntityBuilderConstant.FULLY_QUALIFIED_NAME;
|
||||
import static org.openmetadata.service.search.EntityBuilderConstant.FULLY_QUALIFIED_NAME_PARTS;
|
||||
import static org.openmetadata.service.search.EntityBuilderConstant.NAME_KEYWORD;
|
||||
import static org.openmetadata.service.util.FullyQualifiedName.getParentFQN;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -373,6 +374,7 @@ public interface SearchIndex {
|
||||
|
||||
static Map<String, Float> getDefaultFields() {
|
||||
Map<String, Float> fields = new HashMap<>();
|
||||
fields.put(NAME_KEYWORD, 10.0f);
|
||||
fields.put(DISPLAY_NAME_KEYWORD, 10.0f);
|
||||
fields.put(FIELD_NAME, 10.0f);
|
||||
fields.put(FIELD_NAME_NGRAM, 1.0f);
|
||||
|
||||
@ -3,14 +3,10 @@ package org.openmetadata.service.search.opensearch;
|
||||
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
|
||||
import static javax.ws.rs.core.Response.Status.OK;
|
||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
|
||||
import static org.openmetadata.service.Entity.AGGREGATED_COST_ANALYSIS_REPORT_DATA;
|
||||
import static org.openmetadata.service.Entity.DATA_PRODUCT;
|
||||
import static org.openmetadata.service.Entity.DOMAIN;
|
||||
import static org.openmetadata.service.Entity.FIELD_DESCRIPTION;
|
||||
import static org.openmetadata.service.Entity.FIELD_DISPLAY_NAME;
|
||||
import static org.openmetadata.service.Entity.GLOSSARY_TERM;
|
||||
import static org.openmetadata.service.Entity.QUERY;
|
||||
import static org.openmetadata.service.Entity.RAW_COST_ANALYSIS_REPORT_DATA;
|
||||
import static org.openmetadata.service.Entity.TABLE;
|
||||
import static org.openmetadata.service.events.scheduled.ServicesStatusJobHandler.HEALTHY_STATUS;
|
||||
import static org.openmetadata.service.events.scheduled.ServicesStatusJobHandler.UNHEALTHY_STATUS;
|
||||
@ -383,6 +379,7 @@ public class OpenSearchClient implements SearchClient {
|
||||
public Response doSearch(
|
||||
SearchRequest request, SubjectContext subjectContext, SearchSettings searchSettings)
|
||||
throws IOException {
|
||||
String indexName = Entity.getSearchRepository().getIndexNameWithoutAlias(request.getIndex());
|
||||
OpenSearchSourceBuilderFactory searchBuilderFactory =
|
||||
new OpenSearchSourceBuilderFactory(searchSettings);
|
||||
SearchSourceBuilder searchSourceBuilder =
|
||||
@ -415,59 +412,26 @@ public class OpenSearchClient implements SearchClient {
|
||||
}
|
||||
|
||||
/* For backward-compatibility we continue supporting the deleted argument, this should be removed in future versions */
|
||||
if (request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(Entity.getSearchRepository().getIndexOrAliasName(GLOBAL_SEARCH_ALIAS))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(Entity.getSearchRepository().getIndexOrAliasName("dataAsset"))) {
|
||||
BoolQueryBuilder deletedOptions =
|
||||
QueryBuilders.boolQuery()
|
||||
.should(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(QueryBuilders.existsQuery("deleted"))
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())))
|
||||
.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("deleted")));
|
||||
BoolQueryBuilder combined =
|
||||
QueryBuilders.boolQuery().must(searchSourceBuilder.query()).filter(deletedOptions);
|
||||
if (!nullOrEmpty(request.getDeleted())) {
|
||||
if (indexName.equals(GLOBAL_SEARCH_ALIAS) || indexName.equals(DATA_ASSET_SEARCH_ALIAS)) {
|
||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||
|
||||
searchSourceBuilder.query(combined);
|
||||
} else if (request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository().getIndexMapping(DOMAIN).getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository()
|
||||
.getIndexMapping(DATA_PRODUCT)
|
||||
.getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository().getIndexMapping(QUERY).getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository().getIndexOrAliasName("knowledge_page_search_index"))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository()
|
||||
.getIndexMapping(RAW_COST_ANALYSIS_REPORT_DATA)
|
||||
.getIndexName(clusterAlias))
|
||||
|| request
|
||||
.getIndex()
|
||||
.equalsIgnoreCase(
|
||||
Entity.getSearchRepository()
|
||||
.getIndexMapping(AGGREGATED_COST_ANALYSIS_REPORT_DATA)
|
||||
.getIndexName(clusterAlias))) {
|
||||
searchSourceBuilder.query(QueryBuilders.boolQuery().must(searchSourceBuilder.query()));
|
||||
} else {
|
||||
searchSourceBuilder.query(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())));
|
||||
boolQueryBuilder.should(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.must(QueryBuilders.existsQuery("deleted"))
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())));
|
||||
boolQueryBuilder.should(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.mustNot(QueryBuilders.existsQuery("deleted")));
|
||||
searchSourceBuilder.query(boolQueryBuilder);
|
||||
} else {
|
||||
searchSourceBuilder.query(
|
||||
QueryBuilders.boolQuery()
|
||||
.must(searchSourceBuilder.query())
|
||||
.must(QueryBuilders.termQuery("deleted", request.getDeleted())));
|
||||
}
|
||||
}
|
||||
|
||||
if (!nullOrEmpty(request.getSortFieldParam())
|
||||
|
||||
@ -54,7 +54,7 @@ public class OpenSearchSourceBuilderFactory
|
||||
|
||||
Map<String, Float> nonFuzzyFields =
|
||||
fields.entrySet().stream()
|
||||
.filter(entry -> !isFuzzyField(entry.getKey()))
|
||||
.filter(entry -> isNonFuzzyField(entry.getKey()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
QueryStringQueryBuilder fuzzyQueryBuilder =
|
||||
@ -173,7 +173,7 @@ public class OpenSearchSourceBuilderFactory
|
||||
.collect(Collectors.toMap(FieldBoost::getField, fb -> fb.getBoost().floatValue()));
|
||||
nonFuzzyFields =
|
||||
assetConfig.getSearchFields().stream()
|
||||
.filter(fieldBoost -> !isFuzzyField(fieldBoost.getField()))
|
||||
.filter(fieldBoost -> isNonFuzzyField(fieldBoost.getField()))
|
||||
.collect(Collectors.toMap(FieldBoost::getField, fb -> fb.getBoost().floatValue()));
|
||||
} else {
|
||||
Map<String, Float> defaultFields = SearchIndex.getDefaultFields();
|
||||
@ -183,7 +183,7 @@ public class OpenSearchSourceBuilderFactory
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
nonFuzzyFields =
|
||||
defaultFields.entrySet().stream()
|
||||
.filter(entry -> !isFuzzyField(entry.getKey()))
|
||||
.filter(entry -> isNonFuzzyField(entry.getKey()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,8 @@
|
||||
"deleted": {
|
||||
"description": "Filter documents by deleted param.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"default": null,
|
||||
"existingJavaType": "java.lang.Boolean"
|
||||
},
|
||||
"sortFieldParam": {
|
||||
"description": "Sort the search results by field, available fields to sort weekly_stats daily_stats, monthly_stats, last_updated_timestamp.",
|
||||
|
||||
@ -66,7 +66,7 @@ test('Query Entity', async ({ page }) => {
|
||||
);
|
||||
await page.click(`[data-testid="table_queries"]`);
|
||||
const tableResponse = page.waitForResponse(
|
||||
'/api/v1/search/query?q=**&from=0&size=*&index=table_search_index'
|
||||
'/api/v1/search/query?q=**&from=0&size=*&index=table_search_index*'
|
||||
);
|
||||
await queryResponse;
|
||||
await page.click(`[data-testid="add-query-btn"]`);
|
||||
@ -177,7 +177,7 @@ test('Query Entity', async ({ page }) => {
|
||||
await page.keyboard.type(`${queryData.queryUsedIn.table1}`);
|
||||
await page.click('[data-testid="edit-query-used-in"]');
|
||||
const tableSearchResponse = page.waitForResponse(
|
||||
'/api/v1/search/query?q=*&index=table_search_index'
|
||||
'/api/v1/search/query?q=*&index=table_search_index*'
|
||||
);
|
||||
await page.keyboard.type(queryData.queryUsedIn.table2);
|
||||
await tableSearchResponse;
|
||||
|
||||
@ -43,7 +43,7 @@ test.describe('Service Listing', () => {
|
||||
await page.getByTestId('filter-icon').click();
|
||||
|
||||
const searchBigQueryResponse = page.waitForResponse(
|
||||
`/api/v1/search/query?q=**%20AND%20(serviceType:BigQuery)&from=0&size=15&index=database_service_search_index`
|
||||
`/api/v1/search/query?q=**%20AND%20(serviceType:BigQuery)&from=0&size=15&index=database_service_search_index*`
|
||||
);
|
||||
await page.getByLabel('Big Query').check();
|
||||
await searchBigQueryResponse;
|
||||
@ -53,7 +53,7 @@ test.describe('Service Listing', () => {
|
||||
await page.getByTestId('filter-icon').click();
|
||||
|
||||
const searchResponse = page.waitForResponse(
|
||||
`/api/v1/search/query?q=**%20AND%20(serviceType:BigQuery%20OR%20serviceType:Mysql)&from=0&size=15&index=database_service_search_index`
|
||||
`/api/v1/search/query?q=**%20AND%20(serviceType:BigQuery%20OR%20serviceType:Mysql)&from=0&size=15&index=database_service_search_index*`
|
||||
);
|
||||
await page.getByLabel('Mysql').check();
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ export const addDomainFilter = async ({
|
||||
|
||||
// Search and select domain
|
||||
const getSearchResult = page.waitForResponse(
|
||||
'/api/v1/search/query?q=**index=domain_search_index'
|
||||
'/api/v1/search/query?q=**index=domain_search_index*'
|
||||
);
|
||||
await page.fill(
|
||||
'[data-testid="domain-select"] [role="combobox"]',
|
||||
|
||||
@ -136,7 +136,7 @@ export const selectSubDomain = async (
|
||||
|
||||
await page.getByTestId('subdomains').getByText('Sub Domains').click();
|
||||
const res = page.waitForResponse(
|
||||
'/api/v1/search/query?*&index=data_product_search_index'
|
||||
'/api/v1/search/query?*&index=data_product_search_index*'
|
||||
);
|
||||
await page.getByTestId(subDomain.name).click();
|
||||
await res;
|
||||
@ -147,7 +147,7 @@ export const selectDataProductFromTab = async (
|
||||
dataProduct: DataProduct['data']
|
||||
) => {
|
||||
const dpRes = page.waitForResponse(
|
||||
'/api/v1/search/query?*&from=0&size=50&index=data_product_search_index'
|
||||
'/api/v1/search/query?*&from=0&size=50&index=data_product_search_index*'
|
||||
);
|
||||
await page
|
||||
.locator('.domain-details-page-tabs')
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { expect, Page } from '@playwright/test';
|
||||
import { APIRequestContext, expect, Page } from '@playwright/test';
|
||||
import { get, isUndefined } from 'lodash';
|
||||
import { SidebarItem } from '../constant/sidebar';
|
||||
import { GLOSSARY_TERM_PATCH_PAYLOAD } from '../constant/version';
|
||||
@ -196,7 +196,7 @@ export const addTeamAsReviewer = async (
|
||||
isSelectableInsideForm = false
|
||||
) => {
|
||||
const teamsResponse = page.waitForResponse(
|
||||
'/api/v1/search/query?q=*&from=0&size=*&index=team_search_index&sort_field=displayName.keyword&sort_order=asc'
|
||||
'/api/v1/search/query?q=*&from=0&size=*&index=team_search_index&deleted=false&sort_field=displayName.keyword&sort_order=asc'
|
||||
);
|
||||
|
||||
const teamsSearchResponse = page.waitForResponse(
|
||||
@ -1003,7 +1003,7 @@ export const createDescriptionTaskForGlossary = async (
|
||||
await assigneeField.click();
|
||||
|
||||
const userSearchResponse = page.waitForResponse(
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index`
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index*`
|
||||
);
|
||||
await assigneeField.fill(value.assignee);
|
||||
await userSearchResponse;
|
||||
@ -1058,7 +1058,7 @@ export const createTagTaskForGlossary = async (
|
||||
);
|
||||
await assigneeField.click();
|
||||
const userSearchResponse = page.waitForResponse(
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index`
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index*`
|
||||
);
|
||||
await assigneeField.fill(value.assignee);
|
||||
await userSearchResponse;
|
||||
|
||||
@ -60,7 +60,7 @@ export const createDescriptionTask = async (
|
||||
await assigneeField.click();
|
||||
|
||||
const userSearchResponse = page.waitForResponse(
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index`
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index*`
|
||||
);
|
||||
|
||||
await assigneeField.fill(value.assignee);
|
||||
@ -113,7 +113,7 @@ export const createTagTask = async (
|
||||
await assigneeField.click();
|
||||
|
||||
const userSearchResponse = page.waitForResponse(
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index`
|
||||
`/api/v1/search/query?q=*${value.assignee}**&index=user_search_index%2Cteam_search_index*`
|
||||
);
|
||||
await assigneeField.fill(value.assignee);
|
||||
await userSearchResponse;
|
||||
|
||||
@ -90,7 +90,7 @@ export interface ExploreProps {
|
||||
sortOrder: string;
|
||||
onChangeSortOder: (sortOder: SORT_ORDER) => void;
|
||||
|
||||
showDeleted: boolean;
|
||||
showDeleted?: boolean;
|
||||
onChangeShowDeleted: (showDeleted: boolean) => void;
|
||||
|
||||
onChangePage?: (page: number, size?: number) => void;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { get, isEmpty, isNil, isString } from 'lodash';
|
||||
import { get, isEmpty, isNil, isString, omit } from 'lodash';
|
||||
import Qs from 'qs';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
@ -217,8 +217,22 @@ const ExplorePageV1: FunctionComponent = () => {
|
||||
const handleShowDeletedChange: ExploreProps['onChangeShowDeleted'] = (
|
||||
showDeleted
|
||||
) => {
|
||||
// Removed existing showDeleted from the parsedSearch object
|
||||
const filteredParsedSearch = omit(parsedSearch, 'showDeleted');
|
||||
|
||||
// Set the default search object with page as 1
|
||||
const defaultSearchObject = {
|
||||
...filteredParsedSearch,
|
||||
page: 1,
|
||||
};
|
||||
|
||||
// If showDeleted is true, add it to the search object
|
||||
const searchObject = showDeleted
|
||||
? { ...defaultSearchObject, showDeleted: true }
|
||||
: defaultSearchObject;
|
||||
|
||||
history.push({
|
||||
search: Qs.stringify({ ...parsedSearch, showDeleted, page: 1 }),
|
||||
search: Qs.stringify(searchObject),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -440,7 +440,9 @@ export const parseSearchParams = (search: string) => {
|
||||
? Number.parseInt(parsedSearch.size)
|
||||
: PAGE_SIZE;
|
||||
|
||||
const showDeleted = parsedSearch.showDeleted === 'true';
|
||||
// We are not setting showDeleted as 'false' since we don't want it to conflict with
|
||||
// the `Deleted` field value in the advanced search quick filters when the value there is true.
|
||||
const showDeleted = parsedSearch.showDeleted === 'true' ? true : undefined;
|
||||
|
||||
return {
|
||||
parsedSearch,
|
||||
@ -526,7 +528,7 @@ export const fetchEntityData = async ({
|
||||
updatedQuickFilters: QueryFilterInterface | undefined;
|
||||
queryFilter: unknown;
|
||||
searchIndex: ExploreSearchIndex;
|
||||
showDeleted: boolean;
|
||||
showDeleted?: boolean;
|
||||
sortValue: string;
|
||||
sortOrder: string;
|
||||
page: number;
|
||||
|
||||
@ -73,12 +73,9 @@ export const getSearchAPIQueryParams = (
|
||||
from: start,
|
||||
size,
|
||||
index: searchIndex,
|
||||
deleted: onlyDeleted,
|
||||
};
|
||||
|
||||
if (onlyDeleted) {
|
||||
params.deleted = onlyDeleted;
|
||||
}
|
||||
|
||||
if (!isEmpty(sortField)) {
|
||||
params.sort_field = sortField;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user