From 7c66c0780527e48e9b7bdae807239f1e4b2b65b3 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Sat, 23 Nov 2024 21:38:04 +0530 Subject: [PATCH] chore: Remove Algolia, we don't use it anymore (#37664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Automation /test sanity ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 22f0a6fc7c916a948cdd1ec98183f0113d485d90 > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Sat, 23 Nov 2024 14:45:28 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit ## Release Notes - **Chores** - Removed Algolia Search configuration from various files, including environment variables and configuration scripts. - **Refactor** - Simplified search-related components and utility functions by removing Algolia dependencies, enhancing clarity and usability. - **Bug Fixes** - Adjusted search item type handling to improve type safety and reduce complexity. These updates streamline the application by eliminating unnecessary dependencies and refining existing functionalities. --- .env.example | 5 - .../docker/templates/nginx-app.conf.template | 3 - app/client/jest.config.js | 5 - app/client/package.json | 1 - app/client/public/index.html | 5 - app/client/src/ce/configs/index.ts | 36 ----- app/client/src/ce/configs/types.ts | 7 - .../GlobalSearch/SearchResults.tsx | 3 +- .../editorComponents/GlobalSearch/index.tsx | 3 - .../editorComponents/GlobalSearch/utils.tsx | 2 - app/client/yarn.lock | 141 ------------------ .../fs/opt/appsmith/templates/docker.env.sh | 5 - 12 files changed, 1 insertion(+), 215 deletions(-) diff --git a/.env.example b/.env.example index c67033888e..d81a529a55 100644 --- a/.env.example +++ b/.env.example @@ -21,11 +21,6 @@ APPSMITH_SIGNUP_DISABLED= # Segment APPSMITH_SEGMENT_KEY= -# Algolia Search (Docs) -APPSMITH_ALGOLIA_API_ID= -APPSMITH_ALGOLIA_API_KEY= -APPSMITH_ALGOLIA_SEARCH_INDEX_NAME= - #Client log level (debug | error) APPSMITH_CLIENT_LOG_LEVEL= diff --git a/app/client/docker/templates/nginx-app.conf.template b/app/client/docker/templates/nginx-app.conf.template index 3edd44b8cb..e23bd86a16 100644 --- a/app/client/docker/templates/nginx-app.conf.template +++ b/app/client/docker/templates/nginx-app.conf.template @@ -30,9 +30,6 @@ server { sub_filter __APPSMITH_SENTRY_DSN__ '${APPSMITH_SENTRY_DSN}'; sub_filter __APPSMITH_SMART_LOOK_ID__ '${APPSMITH_SMART_LOOK_ID}'; sub_filter __APPSMITH_SEGMENT_KEY__ '${APPSMITH_SEGMENT_KEY}'; - sub_filter __APPSMITH_ALGOLIA_API_ID__ '${APPSMITH_ALGOLIA_API_ID}'; - sub_filter __APPSMITH_ALGOLIA_SEARCH_INDEX_NAME__ '${APPSMITH_ALGOLIA_SEARCH_INDEX_NAME}'; - sub_filter __APPSMITH_ALGOLIA_API_KEY__ '${APPSMITH_ALGOLIA_API_KEY}'; sub_filter __APPSMITH_CLIENT_LOG_LEVEL__ '${APPSMITH_CLIENT_LOG_LEVEL}'; sub_filter __APPSMITH_SENTRY_RELEASE__ '${APPSMITH_SENTRY_RELEASE}'; sub_filter __APPSMITH_SENTRY_ENVIRONMENT__ '${APPSMITH_SENTRY_ENVIRONMENT}'; diff --git a/app/client/jest.config.js b/app/client/jest.config.js index 06e46734fe..cb8c0ad995 100644 --- a/app/client/jest.config.js +++ b/app/client/jest.config.js @@ -114,11 +114,6 @@ module.exports = { enabled: parseConfig("__APPSMITH_SEGMENT_KEY__"), apiKey: parseConfig("__APPSMITH_MIXPANEL_KEY__"), }, - algolia: { - apiId: parseConfig("__APPSMITH_ALGOLIA_API_ID__"), - apiKey: parseConfig("__APPSMITH_ALGOLIA_API_KEY__"), - indexName: parseConfig("__APPSMITH_ALGOLIA_SEARCH_INDEX_NAME__"), - }, logLevel: CONFIG_LOG_LEVEL_INDEX > -1 ? LOG_LEVELS[CONFIG_LOG_LEVEL_INDEX] diff --git a/app/client/package.json b/app/client/package.json index 154420153c..f0e2adb9c8 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -277,7 +277,6 @@ "@types/react-dom": "^17.0.2", "@types/react-google-recaptcha": "^2.1.1", "@types/react-helmet": "^5.0.14", - "@types/react-instantsearch-core": "^6.26.10", "@types/react-modal": "^3.13.1", "@types/react-redux": "^7.0.1", "@types/react-router-dom": "^5.1.2", diff --git a/app/client/public/index.html b/app/client/public/index.html index eee6c8123c..e8588fa4f8 100755 --- a/app/client/public/index.html +++ b/app/client/public/index.html @@ -251,11 +251,6 @@ enabled: parseConfig('{{env "APPSMITH_SEGMENT_KEY"}}'), apiKey: parseConfig('{{env "APPSMITH_MIXPANEL_KEY"}}'), }, - algolia: { - apiId: parseConfig('{{env "APPSMITH_ALGOLIA_API_ID"}}'), - apiKey: parseConfig('{{env "APPSMITH_ALGOLIA_API_KEY"}}'), - indexName: parseConfig('{{env "APPSMITH_ALGOLIA_SEARCH_INDEX_NAME"}}'), - }, logLevel: CONFIG_LOG_LEVEL_INDEX > -1 ? LOG_LEVELS[CONFIG_LOG_LEVEL_INDEX] diff --git a/app/client/src/ce/configs/index.ts b/app/client/src/ce/configs/index.ts index 62cd798fb2..b58345e488 100644 --- a/app/client/src/ce/configs/index.ts +++ b/app/client/src/ce/configs/index.ts @@ -34,12 +34,6 @@ export interface INJECTED_CONFIGS { apiKey: string; }; cloudHosting: boolean; - algolia: { - apiId: string; - apiKey: string; - indexName: string; - snippetIndex: string; - }; logLevel: "debug" | "error"; appVersion: { id: string; @@ -89,12 +83,6 @@ export const getConfigsFromEnvVars = (): INJECTED_CONFIGS => { : false, apiKey: process.env.REACT_APP_MIXPANEL_KEY || "", }, - algolia: { - apiId: process.env.REACT_APP_ALGOLIA_API_ID || "", - apiKey: process.env.REACT_APP_ALGOLIA_API_KEY || "", - indexName: process.env.REACT_APP_ALGOLIA_SEARCH_INDEX_NAME || "", - snippetIndex: process.env.REACT_APP_ALGOLIA_SNIPPET_INDEX_NAME || "", - }, observability: { deploymentName: process.env.APPSMITH_DEPLOYMENT_NAME || "self-hosted", serviceInstanceId: process.env.HOSTNAME || "appsmith-0", @@ -225,23 +213,6 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => { APPSMITH_FEATURE_CONFIGS?.smartLook.id, ); - const algoliaAPIID = getConfig( - ENV_CONFIG.algolia.apiId, - APPSMITH_FEATURE_CONFIGS?.algolia.apiId, - ); - const algoliaAPIKey = getConfig( - ENV_CONFIG.algolia.apiKey, - APPSMITH_FEATURE_CONFIGS?.algolia.apiKey, - ); - const algoliaIndex = getConfig( - ENV_CONFIG.algolia.indexName, - APPSMITH_FEATURE_CONFIGS?.algolia.indexName, - ); - const algoliaSnippetIndex = getConfig( - ENV_CONFIG.algolia.indexName, - APPSMITH_FEATURE_CONFIGS?.algolia.snippetIndex, - ); - const segmentCEKey = getConfig( ENV_CONFIG.segment.ceKey, APPSMITH_FEATURE_CONFIGS?.segment.ceKey, @@ -289,13 +260,6 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => { enabled: fusioncharts.enabled, licenseKey: fusioncharts.value, }, - algolia: { - enabled: true, - apiId: algoliaAPIID.value || "AZ2Z9CJSJ0", - apiKey: algoliaAPIKey.value || "dfde934d9bdc2e0b14830f1dd3cb240f", - indexName: algoliaIndex.value || "omnibar_docusaurus_index", - snippetIndex: algoliaSnippetIndex.value || "snippet", - }, googleRecaptchaSiteKey: { enabled: googleRecaptchaSiteKey.enabled, apiKey: googleRecaptchaSiteKey.value, diff --git a/app/client/src/ce/configs/types.ts b/app/client/src/ce/configs/types.ts index 0b1868d7fb..57e089b18a 100644 --- a/app/client/src/ce/configs/types.ts +++ b/app/client/src/ce/configs/types.ts @@ -43,13 +43,6 @@ export interface AppsmithUIConfigs { enabled: boolean; licenseKey: string; }; - algolia: { - enabled: boolean; - apiId: string; - apiKey: string; - indexName: string; - snippetIndex: string; - }; mixpanel: { enabled: boolean; diff --git a/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx b/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx index 8bb4db80a6..bad3eadfec 100644 --- a/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx +++ b/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx @@ -1,6 +1,5 @@ import React, { useEffect, useRef, useContext, useMemo } from "react"; import { useSelector } from "react-redux"; -import type { Hit as IHit } from "react-instantsearch-core"; import styled, { css } from "styled-components"; import { getTypographyByKey } from "@appsmith/ads-old"; import Highlight from "./Highlight"; @@ -402,7 +401,7 @@ const SearchItemByType = { }; interface ItemProps { - item: IHit | SearchItem; + item: SearchItem; index: number; query: string; } diff --git a/app/client/src/components/editorComponents/GlobalSearch/index.tsx b/app/client/src/components/editorComponents/GlobalSearch/index.tsx index 1d9cbf438f..d6df653cf0 100644 --- a/app/client/src/components/editorComponents/GlobalSearch/index.tsx +++ b/app/client/src/components/editorComponents/GlobalSearch/index.tsx @@ -25,7 +25,6 @@ import { } from "actions/globalSearchActions"; import type { SearchCategory, SearchItem, SelectEvent } from "./utils"; import { - algoliaHighlightTag, filterCategories, getEntityId, getFilterCategoryList, @@ -101,8 +100,6 @@ const StyledContainer = styled.div<{ category: SearchCategory; query: string }>` } } - ${algoliaHighlightTag}, - & .ais-Highlight-highlighted, & .search-highlighted { background-color: transparent; font-style: normal; diff --git a/app/client/src/components/editorComponents/GlobalSearch/utils.tsx b/app/client/src/components/editorComponents/GlobalSearch/utils.tsx index 4413d68053..46ebeb7146 100644 --- a/app/client/src/components/editorComponents/GlobalSearch/utils.tsx +++ b/app/client/src/components/editorComponents/GlobalSearch/utils.tsx @@ -230,8 +230,6 @@ export const getItemPage = (item: SearchItem): string => { } }; -export const algoliaHighlightTag = "ais-highlight-0000000000"; - // TODO: Fix this the next time the file is edited // eslint-disable-next-line @typescript-eslint/no-explicit-any export const attachKind = (source: any[], kind: string) => { diff --git a/app/client/yarn.lock b/app/client/yarn.lock index fc5e58b766..a53246450b 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -12,107 +12,6 @@ __metadata: languageName: node linkType: hard -"@algolia/client-abtesting@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/client-abtesting@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - "@algolia/requester-browser-xhr": 5.6.1 - "@algolia/requester-fetch": 5.6.1 - "@algolia/requester-node-http": 5.6.1 - checksum: 516f2b91388c98eb309f28b81f9b6467e69e82dc7150be16b88ffdcf1cee9d29e5bef9add3397e8e951626fbd586d38b6e66cd43b298ff47c5cf02fb561176a8 - languageName: node - linkType: hard - -"@algolia/client-analytics@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/client-analytics@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - "@algolia/requester-browser-xhr": 5.6.1 - "@algolia/requester-fetch": 5.6.1 - "@algolia/requester-node-http": 5.6.1 - checksum: fae1b496065a77e33a99cde28982d9b077ce56b84caf2707323f7d180047f8118ee04fb2297f0c2221d4a23b974407ce981fcd41704f2ccfb6e68f867ce4d17e - languageName: node - linkType: hard - -"@algolia/client-common@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/client-common@npm:5.6.1" - checksum: 9d46de033377c90a9f42edeb65a5d68d27610332e92fdddcf489c9c2aa3f0e0ddbe6570239dbc7b163b6914aa4e5e497b6a3f547b4b41fe26766cc126ab4ef49 - languageName: node - linkType: hard - -"@algolia/client-personalization@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/client-personalization@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - "@algolia/requester-browser-xhr": 5.6.1 - "@algolia/requester-fetch": 5.6.1 - "@algolia/requester-node-http": 5.6.1 - checksum: 4a6486a43d82875291d572f1fdec3fcd9306a2872f320972ad44a8a5c3ff1bbca6dd99b399302b3c17ab55a1eed96e05e8ef357867ac4a0fdc6d783f9ee3c5b6 - languageName: node - linkType: hard - -"@algolia/client-search@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/client-search@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - "@algolia/requester-browser-xhr": 5.6.1 - "@algolia/requester-fetch": 5.6.1 - "@algolia/requester-node-http": 5.6.1 - checksum: 540645d05cc05b5e800ba27ad7c4bd3e726de7bd672a7fc79d489dfd0249fae1cdc56218da7c7db9d4ea937d3293edf77964c3d153841df00c2f6d78d8816694 - languageName: node - linkType: hard - -"@algolia/events@npm:^4.0.1": - version: 4.0.1 - resolution: "@algolia/events@npm:4.0.1" - checksum: 4f63943f4554cfcfed91d8b8c009a49dca192b81056d8c75e532796f64828cd69899852013e81ff3fff07030df8782b9b95c19a3da0845786bdfe22af42442c2 - languageName: node - linkType: hard - -"@algolia/recommend@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/recommend@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - "@algolia/requester-browser-xhr": 5.6.1 - "@algolia/requester-fetch": 5.6.1 - "@algolia/requester-node-http": 5.6.1 - checksum: 70e362935a17967fc1ad58e8f168d07e47919526e2ed468dd8eb55fee77e2b2f5b499014ef680a5a83cf575f6b5fa691b2648b47642db9419b767bc8a55f68cb - languageName: node - linkType: hard - -"@algolia/requester-browser-xhr@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/requester-browser-xhr@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - checksum: 4196a0bb16133b47aaebfa407c375967c7df661f9df19909d02f669b884d7137269010f53191642ce0c525abca4b38cf58695d986a98f3e4a0d541fcad3a54c5 - languageName: node - linkType: hard - -"@algolia/requester-fetch@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/requester-fetch@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - checksum: 240eb4d3028f98c271014fcbe3ab245cc8dfdb87f91aaff7dc66eff41182f70fcf0f891f03a8050183c2f5ce4f5e2410b2ec47263c9b715eee6ecb880fb5a45a - languageName: node - linkType: hard - -"@algolia/requester-node-http@npm:5.6.1": - version: 5.6.1 - resolution: "@algolia/requester-node-http@npm:5.6.1" - dependencies: - "@algolia/client-common": 5.6.1 - checksum: d27a69b14b1a1fabeeb23e41cffced8e2edd2e52d93fbdadd2fbadfd775b21fa484a20bb63ea0373d8c2a339069c7e0681588d94d775b8a168dcc4cad96b684a - languageName: node - linkType: hard - "@alloc/quick-lru@npm:^5.2.0": version: 5.2.0 resolution: "@alloc/quick-lru@npm:5.2.0" @@ -10985,17 +10884,6 @@ __metadata: languageName: node linkType: hard -"@types/react-instantsearch-core@npm:^6.26.10": - version: 6.26.10 - resolution: "@types/react-instantsearch-core@npm:6.26.10" - dependencies: - "@types/react": "*" - algoliasearch: ">=4" - algoliasearch-helper: ">=3" - checksum: 7f5ce45ffceec268fc6697b59ed137804f8256c7cd94ec00e8a69f7070e6d4b201c1c57bd38a0afe9ecca4161a853823cea5aeeae9532b28169aa48a2501e24e - languageName: node - linkType: hard - "@types/react-modal@npm:^3.13.1": version: 3.13.1 resolution: "@types/react-modal@npm:3.13.1" @@ -12627,34 +12515,6 @@ __metadata: languageName: node linkType: hard -"algoliasearch-helper@npm:>=3": - version: 3.22.5 - resolution: "algoliasearch-helper@npm:3.22.5" - dependencies: - "@algolia/events": ^4.0.1 - peerDependencies: - algoliasearch: ">= 3.1 < 6" - checksum: bf1f0573778a5d4398efbc723558eaa7efd81a0c906c8c6339d6ab243e065c8dabea656c5bb914cda8dfa57e7af3c16e5370b0399f265a2a3dc49fed0dceedac - languageName: node - linkType: hard - -"algoliasearch@npm:>=4": - version: 5.6.1 - resolution: "algoliasearch@npm:5.6.1" - dependencies: - "@algolia/client-abtesting": 5.6.1 - "@algolia/client-analytics": 5.6.1 - "@algolia/client-common": 5.6.1 - "@algolia/client-personalization": 5.6.1 - "@algolia/client-search": 5.6.1 - "@algolia/recommend": 5.6.1 - "@algolia/requester-browser-xhr": 5.6.1 - "@algolia/requester-fetch": 5.6.1 - "@algolia/requester-node-http": 5.6.1 - checksum: 32ed2e9aba9953171546f3a9b3270e18943884d2debad3f7c680883d3fb93380a98ba4e0cec0e9faa71f5978df6e9163338317e44039423808bc1d23777a935b - languageName: node - linkType: hard - "ally.js@npm:^1.4.1": version: 1.4.1 resolution: "ally.js@npm:1.4.1" @@ -12923,7 +12783,6 @@ __metadata: "@types/react-dom": ^17.0.2 "@types/react-google-recaptcha": ^2.1.1 "@types/react-helmet": ^5.0.14 - "@types/react-instantsearch-core": ^6.26.10 "@types/react-modal": ^3.13.1 "@types/react-page-visibility": ^6.4.1 "@types/react-redux": ^7.0.1 diff --git a/deploy/docker/fs/opt/appsmith/templates/docker.env.sh b/deploy/docker/fs/opt/appsmith/templates/docker.env.sh index d183f24767..abab8bcc9e 100644 --- a/deploy/docker/fs/opt/appsmith/templates/docker.env.sh +++ b/deploy/docker/fs/opt/appsmith/templates/docker.env.sh @@ -29,11 +29,6 @@ APPSMITH_SIGNUP_DISABLED= # Segment APPSMITH_SEGMENT_KEY= -# Algolia Search (Docs) -APPSMITH_ALGOLIA_API_ID= -APPSMITH_ALGOLIA_API_KEY= -APPSMITH_ALGOLIA_SEARCH_INDEX_NAME= - #Client log level (debug | error) APPSMITH_CLIENT_LOG_LEVEL=