-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hub-common): hubSearchItems filters aggregations requests by the…
… provided query (#1327) affects: @esri/hub-common
- Loading branch information
1 parent
e22ef09
commit df53fb9
Showing
3 changed files
with
24 additions
and
36 deletions.
There are no files selected for viewing
7 changes: 3 additions & 4 deletions
7
packages/common/src/search/_internal/hubSearchItemsHelpers/getOgcAggregationQueryParams.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
import { getProp } from "../../../objects/get-prop"; | ||
import { IQuery } from "../../types/IHubCatalog"; | ||
import { IHubSearchOptions } from "../../types/IHubSearchOptions"; | ||
import { getOpenDataQueryParam } from "./getOpenDataQueryParam"; | ||
import { getFilterQueryParam } from "./getFilterQueryParam"; | ||
|
||
export function getOgcAggregationQueryParams( | ||
query: IQuery, | ||
options: IHubSearchOptions | ||
) { | ||
// TODO: use options.aggLimit once the OGC API supports it | ||
const aggregations = `terms(fields=(${options.aggFields.join()}))`; | ||
// TODO: Use the rest of `query` to filter aggregations once the OGC API supports it | ||
const openData = getOpenDataQueryParam(query); | ||
const filter = getFilterQueryParam(query); | ||
const token = getProp(options, "requestOptions.authentication.token"); | ||
|
||
return { | ||
aggregations, | ||
openData, | ||
filter, | ||
token, | ||
}; | ||
} |
16 changes: 0 additions & 16 deletions
16
packages/common/src/search/_internal/hubSearchItemsHelpers/getOpenDataQueryParam.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters