From c133e3e4e67c5c40332d2c70ac6cb4ef2e28832b Mon Sep 17 00:00:00 2001 From: Jordan Sanz Date: Wed, 18 Sep 2024 09:48:34 -0400 Subject: [PATCH 1/4] fix(): export serailze filter func for poc --- packages/common/src/search/serializeQueryForPortal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/search/serializeQueryForPortal.ts b/packages/common/src/search/serializeQueryForPortal.ts index ef993a1dc03..3de255e2630 100644 --- a/packages/common/src/search/serializeQueryForPortal.ts +++ b/packages/common/src/search/serializeQueryForPortal.ts @@ -69,7 +69,7 @@ function mergeSearchOptions( * @param filter * @returns */ -function serializeFilter(filter: IFilter): ISearchOptions { +export function serializeFilter(filter: IFilter): ISearchOptions { const operation = filter.operation || "AND"; const predicates = filter.predicates.map(expandPredicate); From f225708e02b097d94bb49b44fa098294a29b48fd Mon Sep 17 00:00:00 2001 From: Jordan Sanz Date: Wed, 18 Sep 2024 12:55:53 -0400 Subject: [PATCH 2/4] feat(): return search options metadata from hubSearch response --- .../search/_internal/hubSearchItemsHelpers/interfaces.ts | 1 + packages/common/src/search/_internal/portalSearchGroups.ts | 1 + packages/common/src/search/_internal/portalSearchItems.ts | 1 + packages/common/src/search/_internal/portalSearchUsers.ts | 2 ++ packages/common/src/search/types/IHubSearchResponse.ts | 6 ++++++ 5 files changed, 11 insertions(+) diff --git a/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts b/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts index 007562919cb..f0e3592ca3a 100644 --- a/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts +++ b/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts @@ -23,6 +23,7 @@ export interface IOgcItemsResponse { numberMatched: number; numberReturned: number; links: IOgcLink[]; + searchOptions?: string; } interface IOgcItemFieldAggregation { diff --git a/packages/common/src/search/_internal/portalSearchGroups.ts b/packages/common/src/search/_internal/portalSearchGroups.ts index d64e79c18ea..5aca36b6c85 100644 --- a/packages/common/src/search/_internal/portalSearchGroups.ts +++ b/packages/common/src/search/_internal/portalSearchGroups.ts @@ -105,6 +105,7 @@ async function searchPortal( resp.total, searchPortal ), + so: searchOptions, }; } diff --git a/packages/common/src/search/_internal/portalSearchItems.ts b/packages/common/src/search/_internal/portalSearchItems.ts index d25fc2f5204..5e6d5b84862 100644 --- a/packages/common/src/search/_internal/portalSearchItems.ts +++ b/packages/common/src/search/_internal/portalSearchItems.ts @@ -208,6 +208,7 @@ async function searchPortalAsHubSearchResult( resp.total, searchPortalAsHubSearchResult ), + so: searchOptions, }; } diff --git a/packages/common/src/search/_internal/portalSearchUsers.ts b/packages/common/src/search/_internal/portalSearchUsers.ts index 1d6254ee34b..4848580483d 100644 --- a/packages/common/src/search/_internal/portalSearchUsers.ts +++ b/packages/common/src/search/_internal/portalSearchUsers.ts @@ -203,6 +203,7 @@ async function searchPortal( resp.total, searchPortal ), + so: searchOptions, }; } @@ -232,6 +233,7 @@ async function searchCommunity( resp.total, searchCommunity ), + so: searchOptions, }; } diff --git a/packages/common/src/search/types/IHubSearchResponse.ts b/packages/common/src/search/types/IHubSearchResponse.ts index 5fc89183e5b..e5e81c233fd 100644 --- a/packages/common/src/search/types/IHubSearchResponse.ts +++ b/packages/common/src/search/types/IHubSearchResponse.ts @@ -1,3 +1,4 @@ +import { ISearchOptions } from "@esri/arcgis-rest-portal"; import { IMessage } from "../../types/IMessage"; import { IHubAggregation } from "./IHubAggregation"; @@ -36,4 +37,9 @@ export interface IHubSearchResponse { * Array of messages / warnings */ messages?: IMessage[]; + + /** + * Search options metadata used to fetch the results + */ + so?: ISearchOptions; } From e27a6f6f6f2becafb3a09a6e8d457bc93cfdda79 Mon Sep 17 00:00:00 2001 From: Jordan Sanz Date: Mon, 23 Sep 2024 12:26:11 -0400 Subject: [PATCH 3/4] fix(): do not export anymore --- packages/common/src/search/serializeQueryForPortal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/search/serializeQueryForPortal.ts b/packages/common/src/search/serializeQueryForPortal.ts index 3de255e2630..ef993a1dc03 100644 --- a/packages/common/src/search/serializeQueryForPortal.ts +++ b/packages/common/src/search/serializeQueryForPortal.ts @@ -69,7 +69,7 @@ function mergeSearchOptions( * @param filter * @returns */ -export function serializeFilter(filter: IFilter): ISearchOptions { +function serializeFilter(filter: IFilter): ISearchOptions { const operation = filter.operation || "AND"; const predicates = filter.predicates.map(expandPredicate); From 764d39faea3c6c7ef9b84e9f8c453175a3c25b38 Mon Sep 17 00:00:00 2001 From: Jordan Sanz Date: Mon, 23 Sep 2024 14:24:42 -0400 Subject: [PATCH 4/4] fix(): remove so addition from IOgc --- .../src/search/_internal/hubSearchItemsHelpers/interfaces.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts b/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts index f0e3592ca3a..007562919cb 100644 --- a/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts +++ b/packages/common/src/search/_internal/hubSearchItemsHelpers/interfaces.ts @@ -23,7 +23,6 @@ export interface IOgcItemsResponse { numberMatched: number; numberReturned: number; links: IOgcLink[]; - searchOptions?: string; } interface IOgcItemFieldAggregation {