diff --git a/docs/search-core.source.md b/docs/search-core.source.md index 545b7d31..db5b9cc5 100644 --- a/docs/search-core.source.md +++ b/docs/search-core.source.md @@ -16,12 +16,9 @@ export declare enum Source | Member | Value | Description | | --- | --- | --- | -| Algolia | "ALGOLIA" | The result is from Algolia. | -| Bing | "BING_CSE" | The result is from Bing Search Engine. | | Custom | "CUSTOM_SEARCHER" | The result was from a custom source. | | DocumentVertical | "DOCUMENT_VERTICAL" | The result is from a document vertical. | | FunctionVertical | "FUNCTION_VERTICAL" | The result is from a function vertical. | | Google | "GOOGLE_CSE" | The result is from Google Custom Search Engine. | | KnowledgeManager | "KNOWLEDGE_MANAGER" | The result is from a Knowledge Graph. | -| Zendesk | "ZENDESK" | The result is from Zendesk. | diff --git a/etc/search-core.api.md b/etc/search-core.api.md index dbcfb723..3fe57647 100644 --- a/etc/search-core.api.md +++ b/etc/search-core.api.md @@ -750,14 +750,11 @@ export enum SortType { // @public export enum Source { - Algolia = "ALGOLIA", - Bing = "BING_CSE", Custom = "CUSTOM_SEARCHER", DocumentVertical = "DOCUMENT_VERTICAL", FunctionVertical = "FUNCTION_VERTICAL", Google = "GOOGLE_CSE", - KnowledgeManager = "KNOWLEDGE_MANAGER", - Zendesk = "ZENDESK" + KnowledgeManager = "KNOWLEDGE_MANAGER" } // @public diff --git a/package-lock.json b/package-lock.json index b61dc53a..d9a6dc0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-core", - "version": "2.6.0-beta.3", + "version": "2.6.0-beta.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-core", - "version": "2.6.0-beta.3", + "version": "2.6.0-beta.4", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", diff --git a/package.json b/package.json index c814640f..ff0aa228 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-core", - "version": "2.6.0-beta.3", + "version": "2.6.0-beta.4", "description": "Typescript Networking Library for the Yext Search API", "main": "./dist/commonjs/src/index.js", "module": "./dist/esm/src/index.js", diff --git a/src/models/searchservice/response/Source.ts b/src/models/searchservice/response/Source.ts index 158027a9..2f0c500e 100644 --- a/src/models/searchservice/response/Source.ts +++ b/src/models/searchservice/response/Source.ts @@ -8,16 +8,10 @@ export enum Source { KnowledgeManager = 'KNOWLEDGE_MANAGER', /** The result is from Google Custom Search Engine. */ Google = 'GOOGLE_CSE', - /** The result is from Bing Search Engine. */ - Bing = 'BING_CSE', - /** The result is from Zendesk. */ - Zendesk = 'ZENDESK', - /** The result is from Algolia. */ - Algolia = 'ALGOLIA', /** The result was from a custom source. */ Custom = 'CUSTOM_SEARCHER', /** The result is from a document vertical. */ DocumentVertical = 'DOCUMENT_VERTICAL', /** The result is from a function vertical. */ FunctionVertical = 'FUNCTION_VERTICAL', -} \ No newline at end of file +} diff --git a/src/transformers/searchservice/ResultsFactory.ts b/src/transformers/searchservice/ResultsFactory.ts index e7989f10..1b4270a9 100644 --- a/src/transformers/searchservice/ResultsFactory.ts +++ b/src/transformers/searchservice/ResultsFactory.ts @@ -18,12 +18,6 @@ export class ResultsFactory { return this.fromKnowledgeManager(result, resultIndex); case Source.Google: return this.fromGoogleCustomSearchEngine(result, resultIndex); - case Source.Bing: - return this.fromBingCustomSearchEngine(result, resultIndex); - case Source.Zendesk: - return this.fromZendeskSearchEngine(result, resultIndex); - case Source.Algolia: - return this.fromAlgoliaSearchEngine(result, resultIndex); case Source.DocumentVertical: return this.fromDocumentVertical(result, resultIndex); case Source.FunctionVertical: @@ -79,41 +73,6 @@ export class ResultsFactory { }; } - private static fromBingCustomSearchEngine(result: any, index: number): Result { - const rawData = result.data ?? result; - return { - rawData: rawData, - source: Source.Bing, - index: index, - name: rawData.name, - description: rawData.snippet, - link: rawData.url - }; - } - - private static fromZendeskSearchEngine(result: any, index: number): Result { - const rawData = result.data ?? result; - return { - rawData: rawData, - source: Source.Zendesk, - index: index, - name: rawData.title, - description: rawData.snippet, - link: rawData.html_url - }; - } - - private static fromAlgoliaSearchEngine(result: any, index: number): Result { - const rawData = result.data ?? result; - return { - rawData: rawData, - source: Source.Algolia, - index: index, - name: rawData.name, - id: rawData.objectID - }; - } - private static fromCustomSource(result: any, index: number): Result { return this.fromCustomDataHelper(result, index, Source.Custom); } diff --git a/tests/transformers/searchservice/ResultsFactory.ts b/tests/transformers/searchservice/ResultsFactory.ts index ffedef6e..749ceefa 100644 --- a/tests/transformers/searchservice/ResultsFactory.ts +++ b/tests/transformers/searchservice/ResultsFactory.ts @@ -42,59 +42,6 @@ it('properly transforms Knowledge Graph results', () => { expect(expectedResults).toMatchObject(actualResults); }); -it('properly transforms Zendesk results', () => { - const zendeskData = [{ - html_url: 'https://help.yext.com/', - id: 8273729837, - snippet: 'Enter the Preview link into the text box.', - title: 'Add Custom Schema.org Markup', - }]; - - const expectedResults = [{ - description: 'Enter the Preview link into the text box.', - index: 1, - link: 'https://help.yext.com/', - name: 'Add Custom Schema.org Markup', - rawData: { - html_url: 'https://help.yext.com/', - id: 8273729837, - snippet: 'Enter the Preview link into the text box.', - title: 'Add Custom Schema.org Markup', - }, - source: 'ZENDESK', - }]; - - const actualResults = ResultsFactory.create(zendeskData, Source.Zendesk); - expect(expectedResults).toMatchObject(actualResults); -}); - -it('properly transforms Algolia results', () => { - const algoliaData = [{ - location: 'Atlanta', - logoUrl: 'Hawks_Atlanta.gif', - name: 'Hawks', - objectID: '49688642', - score: 595.5714285714286 - }]; - - const expectedResults = [{ - id: '49688642', - index: 1, - name: 'Hawks', - rawData: { - location: 'Atlanta', - logoUrl: 'Hawks_Atlanta.gif', - name: 'Hawks', - objectID: '49688642', - score: 595.5714285714286, - }, - source: 'ALGOLIA', - }]; - - const actualResults = ResultsFactory.create(algoliaData, Source.Algolia); - expect(expectedResults).toMatchObject(actualResults); -}); - it('properly transforms Google Custom Search results', () => { const googleData = [{ displayLink: 'www.yext.com', @@ -121,32 +68,6 @@ it('properly transforms Google Custom Search results', () => { expect(expectedResults).toMatchObject(actualResults); }); -it('properly transforms Bing search results', () => { - const bingData = [{ - displayUrl: 'www.yext.com/support', - name: 'Yext support', - snippet: 'Get help from Yext', - url: 'http://www.yext.com/support' - }]; - - const expectedResults = [{ - description: 'Get help from Yext', - index: 1, - link: 'http://www.yext.com/support', - name: 'Yext support', - rawData: { - displayUrl: 'www.yext.com/support', - name: 'Yext support', - snippet: 'Get help from Yext', - url: 'http://www.yext.com/support', - }, - source: 'BING_CSE', - }]; - - const actualResults = ResultsFactory.create(bingData, Source.Bing); - expect(expectedResults).toMatchObject(actualResults); -}); - it('properly transforms backend results from custom source', () => { const genericData = [{ data: { @@ -217,4 +138,4 @@ it('properly transforms backend results from function vertical', () => { const actualResults = ResultsFactory.create(genericData, Source.FunctionVertical); expect(expectedResults).toMatchObject(actualResults); -}); \ No newline at end of file +});