Open asizer opened 4 years ago
ugh, sorry, wrong repo 🤦♀
hi @asizer! :wave:
I know you said you logged this in the wrong repo, but just a heads up, you can use ISearchOptions.params
to pass through any request parameter you want.
searchItems({
params: { foo: 'bar' }
})
ooh, thanks so much @jgravois, that works! sorry i missed that!
ok, sorry, it's late, and tired, so i may be mistaken, but it's looking to me like params
gets reassigned with all the standard stuff in my query as part of appendCustomParams
. So if I start out with:
search: {
q: "my awesome query here",
start: 1,
num: 100,
params: {
categories: "/Categories/Trending"
}
}
it becomes this after appendCustomParams
:
search: {
q: "my awesome query here",
start: 1,
num: 100,
params: {
categories: "/Categories/Trending"
q: "my awesome query here",
start: 1,
num: 100,
params: { // <--- OH NO!
categories: "/Categories/Trending"
...
(repeat all the search properties circularly and infinitely here)
...
}
}
}
here's appendCustomParams. should the starting value maybe be {}
instead of options.params
?:
https://github.com/Esri/arcgis-rest-js/blob/13bbea4ee995c1a7ba6936ea4ad16c3ff887927f/packages/arcgis-rest-request/src/utils/append-custom-params.ts#L31-L37
or maybe it's how this is interacting with the genericSearch
and the search properties enumerated there?
https://github.com/Esri/arcgis-rest-js/blob/b91af15a0524ace69edfdaa5ccdea9da257746a9/packages/arcgis-rest-portal/src/util/generic-search.ts#L29-L35
it becomes this after
appendCustomParams
search: { q: "my awesome query here", start: 1, num: 100, params: { categories: "/Categories/Trending" q: "my awesome query here", start: 1, num: 100, params: { // <--- OH NO! categories: "/Categories/Trending" ... (repeat all the search properties circularly and infinitely here) ... } } }
are you saying those are the request parameters? this test would lead me to believe that the library is already doing what its supposed to.
I was trying to do a
searchItems
with custom params, but they kept getting stripped out.It looks like
genericSearch
(which is used bysearchItems
) only allows these params: https://github.com/Esri/arcgis-rest-js/blob/13bbea4ee995c1a7ba6936ea4ad16c3ff887927f/packages/arcgis-rest-portal/src/util/generic-search.ts#L29-L35even though
ISearchOptions
type definition looks like it's possible to add other params: https://github.com/Esri/arcgis-rest-js/blob/13bbea4ee995c1a7ba6936ea4ad16c3ff887927f/packages/arcgis-rest-portal/src/util/search.ts#L8-L13should item search support all these parameters? https://developers.arcgis.com/rest/users-groups-and-items/search.htm#GUID-A2C8BFD1-89B2-483F-9275-65D2786F6A6C