diff --git a/docs/search-core.source.md b/docs/search-core.source.md index 6dc1c3cd..757e57cc 100644 --- a/docs/search-core.source.md +++ b/docs/search-core.source.md @@ -16,11 +16,8 @@ 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. | | 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 fd9230ac..1435c291 100644 --- a/etc/search-core.api.md +++ b/etc/search-core.api.md @@ -728,13 +728,10 @@ export enum SortType { // @public export enum Source { - Algolia = "ALGOLIA", - Bing = "BING_CSE", Custom = "CUSTOM_SEARCHER", DocumentVertical = "DOCUMENT_VERTICAL", Google = "GOOGLE_CSE", - KnowledgeManager = "KNOWLEDGE_MANAGER", - Zendesk = "ZENDESK" + KnowledgeManager = "KNOWLEDGE_MANAGER" } // @public diff --git a/package-lock.json b/package-lock.json index fc9cd15f..541c6f5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-core", - "version": "2.5.2", + "version": "2.5.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-core", - "version": "2.5.2", + "version": "2.5.3", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", diff --git a/package.json b/package.json index add1e65d..a40aa9f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-core", - "version": "2.5.2", + "version": "2.5.3", "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 ddbebe9d..08288cb8 100644 --- a/src/models/searchservice/response/Source.ts +++ b/src/models/searchservice/response/Source.ts @@ -8,14 +8,8 @@ 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', -} \ No newline at end of file +} diff --git a/src/transformers/searchservice/ResultsFactory.ts b/src/transformers/searchservice/ResultsFactory.ts index 944e1c4d..d8909582 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); default: @@ -77,41 +71,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 { const rawData = result.data ?? result; return { diff --git a/tests/transformers/searchservice/ResultsFactory.ts b/tests/transformers/searchservice/ResultsFactory.ts index 210c1c50..627184bd 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: { @@ -183,4 +104,4 @@ it('properly transforms backend results from custom source', () => { const actualResults = ResultsFactory.create(genericData, Source.Custom); expect(expectedResults).toMatchObject(actualResults); -}); \ No newline at end of file +});