diff --git a/packages/arcgis-rest-portal/src/util/SearchQueryBuilder.ts b/packages/arcgis-rest-portal/src/util/SearchQueryBuilder.ts index 0d30aeb22b..b42ae74137 100644 --- a/packages/arcgis-rest-portal/src/util/SearchQueryBuilder.ts +++ b/packages/arcgis-rest-portal/src/util/SearchQueryBuilder.ts @@ -27,7 +27,7 @@ import { IParamBuilder, warn } from "@esri/arcgis-rest-request"; * * Will search for items matching * ``` - * "owner: Patrick AND (type: "Web Mapping Application" OR type: "Mobile Application" OR type: Application) AND Demo App" + * "owner: Patrick AND (type:"Web Mapping Application" OR type:"Mobile Application" OR type:Application) AND Demo App" * ``` */ export class SearchQueryBuilder implements IParamBuilder { @@ -82,7 +82,7 @@ export class SearchQueryBuilder implements IParamBuilder { } if (field && field !== "*") { - this.q += `${field}: `; + this.q += `${field}:`; } return this.commit(); diff --git a/packages/arcgis-rest-portal/test/groups/search.test.ts b/packages/arcgis-rest-portal/test/groups/search.test.ts index eedc2e9e38..34d36cda09 100644 --- a/packages/arcgis-rest-portal/test/groups/search.test.ts +++ b/packages/arcgis-rest-portal/test/groups/search.test.ts @@ -55,7 +55,7 @@ describe("groups", () => { it("should make a simple, single search request with a builder", done => { fetchMock.once("*", GroupSearchResponse); - const expectedParam = "Trees AND owner: USFS"; + const expectedParam = "Trees AND owner:USFS"; const q = new SearchQueryBuilder() .match("Trees") .and() diff --git a/packages/arcgis-rest-portal/test/items/search.test.ts b/packages/arcgis-rest-portal/test/items/search.test.ts index 6fbac5875a..4acbc577e2 100644 --- a/packages/arcgis-rest-portal/test/items/search.test.ts +++ b/packages/arcgis-rest-portal/test/items/search.test.ts @@ -33,7 +33,7 @@ describe("search", () => { it("should make a simple, single search request with a builder", done => { fetchMock.once("*", SearchResponse); - const expectedParam = "DC AND typekeywords: hubSiteApplication"; + const expectedParam = "DC AND typekeywords:hubSiteApplication"; const q = new SearchQueryBuilder() .match("DC") .and() @@ -108,7 +108,7 @@ describe("search", () => { it("should pass through other requestOptions at the same time with a builder", done => { fetchMock.once("*", SearchResponse); - const expectedParam = "DC AND typekeywords: hubSiteApplication"; + const expectedParam = "DC AND typekeywords:hubSiteApplication"; const q = new SearchQueryBuilder() .match("DC") .and() diff --git a/packages/arcgis-rest-portal/test/util/SearchQueryBuilder.test.ts b/packages/arcgis-rest-portal/test/util/SearchQueryBuilder.test.ts index 5437e00d18..40b24d1cd5 100644 --- a/packages/arcgis-rest-portal/test/util/SearchQueryBuilder.test.ts +++ b/packages/arcgis-rest-portal/test/util/SearchQueryBuilder.test.ts @@ -31,7 +31,7 @@ describe("SearchQueryBuilder", () => { .match("test") .in("tags") .toParam(); - expect(query).toEqual("tags: test"); + expect(query).toEqual("tags:test"); }); it("should warp multi word search terms in quotes", () => { @@ -63,7 +63,7 @@ describe("SearchQueryBuilder", () => { .in("tags") .toParam(); - expect(query).toEqual("bar AND tags: foo"); + expect(query).toEqual("bar AND tags:foo"); }); it("should format a simple range", () => { @@ -72,7 +72,7 @@ describe("SearchQueryBuilder", () => { .to("z") .in("title") .toParam(); - expect(query).toEqual("title: [a TO z]"); + expect(query).toEqual("title:[a TO z]"); }); it("should format a simple group", () => { @@ -83,7 +83,7 @@ describe("SearchQueryBuilder", () => { .in("title") .endGroup() .toParam(); - expect(query).toEqual("(title: [a TO z])"); + expect(query).toEqual("(title:[a TO z])"); }); it("should boost the previous search", () => { @@ -110,7 +110,7 @@ describe("SearchQueryBuilder", () => { .toParam(); expect(query).toEqual( - `created: [${expectedDate1} TO ${expectedDate2}] AND tags: test` + `created:[${expectedDate1} TO ${expectedDate2}] AND tags:test` ); }); @@ -135,7 +135,7 @@ describe("SearchQueryBuilder", () => { .toParam(); expect(query).toEqual( - `owner: fred AND (type: "Web Mapping Application" OR type: "Mobile Application" OR type: Application) AND test` + `owner:fred AND (type:"Web Mapping Application" OR type:"Mobile Application" OR type:Application) AND test` ); }); @@ -162,11 +162,11 @@ describe("SearchQueryBuilder", () => { .in("*"); expect(myAppsQuery.toParam()).toEqual( - `owner: fred AND (type: "Web Mapping Application" OR type: "Mobile Application" OR type: Application)` + `owner:fred AND (type:"Web Mapping Application" OR type:"Mobile Application" OR type:Application)` ); expect(myTestAppsQuery.toParam()).toEqual( - `owner: fred AND (type: "Web Mapping Application" OR type: "Mobile Application" OR type: Application) AND test` + `owner:fred AND (type:"Web Mapping Application" OR type:"Mobile Application" OR type:Application) AND test` ); }); @@ -296,7 +296,7 @@ describe("SearchQueryBuilder", () => { .toParam(); expect(console.warn).toHaveBeenCalled(); - expect(query).toEqual("title: a"); + expect(query).toEqual("title:a"); }); it("should not allow .match().from().in(), and warn user", () => { @@ -307,7 +307,7 @@ describe("SearchQueryBuilder", () => { .toParam(); expect(console.warn).toHaveBeenCalled(); - expect(query).toEqual("title: test"); + expect(query).toEqual("title:test"); }); it("should", () => {