Last active
November 1, 2024 02:52
-
-
Save gabrielecanepa/af5f1a2e6bab457997b7519eb374d730 to your computer and use it in GitHub Desktop.
Revisions
-
gabrielecanepa renamed this gist
Nov 1, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Gabriele Canepa revised this gist
Mar 21, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,4 @@ This tool is used to copy the content and settings of an Algolia index from one 2. In `index.js`, specify the right values for the source/target applications and indices. 3. Run `yarn start` (or directly `node index.js`) to copy the content and settings of the source index to the target index. If the target index doesn't exist, it will be automatically created. -
Gabriele Canepa revised this gist
Mar 21, 2023 . No changes.There are no files selected for viewing
-
Gabriele Canepa revised this gist
Mar 21, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,6 @@ This tool is used to copy the content and settings of an Algolia index from one 1. Run `yarn install` to install the `algoliasearch` dependency. 2. In `index.js`, specify the right values for the source/target applications and indices. 3. Run `yarn start` (or directly `node index.js`) to copy the content and settings of the source index to the target index. -
Gabriele Canepa revised this gist
Mar 21, 2023 . 1 changed file with 0 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +0,0 @@ -
Gabriele Canepa revised this gist
Mar 21, 2023 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,10 @@ logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* node_modules/ .npm .node_repl_history *.tgz .yarn-integrity -
Gabriele Canepa created this gist
Mar 21, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ node_modules/ .npm npm-debug.log* yarn-debug.log* yarn-error.log* .yarn-integrity logs *.log This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ # Algolia Copier This tool is used to copy the content and settings of an Algolia index from one application to another. ## Usage 1. Run `yarn install` to install the `algoliasearch` dependency. 2. In `index.js`, specify the right values for the source/target indices and applications. 3. Run `yarn start` (or directly `node index.js`) to copy the content and settings of the source index to the target index. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ import algoliasearch from 'algoliasearch' const sourceClient = algoliasearch('<SOURCE_APP_ID>', '<SOURCE_ADMIN_KEY>') const sourceIndex = sourceClient.initIndex('<SOURCE_INDEX_NAME>') const targetClient = algoliasearch('<TARGET_APP_ID>', '<TARGET_ADMIN_KEY>') const targetIndex = targetClient.initIndex('<TARGET_INDEX_NAME>') const run = async () => { try { // Hits const hits = [] await sourceIndex.browseObjects({ batch: batch => hits.push(batch) }) await targetIndex.saveObjects(hits) // Settings const settings = await sourceIndex.getSettings() await targetIndex.setSettings(settings) // Synonyms const synonyms = await sourceIndex.browseSynonyms() await targetIndex.saveSynonyms(synonyms) // Rules const rules = await sourceIndex.browseRules() await targetIndex.saveRules(rules) } catch (e) { console.error(e) } } run() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ { "name": "algolia-copier", "version": "1.0.0", "main": "index.js", "license": "MIT", "dependencies": { "algoliasearch": "^4.15.0" }, "scripts": { "start": "node index.js" } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,127 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@algolia/cache-browser-local-storage@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.15.0.tgz#84f12aec6b6aa69542a3bfd3a4ba458ed2cc8230" integrity sha512-uxxFhTWh4JJDb2+FFSmNMfEQ8p9o2vjSpU7iW007QX3OvqljPPN68lk3bpZVaG8pwr5MU1DqpkZ71FcQdVTjgQ== dependencies: "@algolia/cache-common" "4.15.0" "@algolia/cache-common@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/cache-common/-/cache-common-4.15.0.tgz#a198098c4b8fa6ef661879ec22d2a2d1ad77d2bb" integrity sha512-Me3PbI4QurAM+3D+htIE0l1xt6+bl/18SG6Wc7bPQEZAtN7DTGz22HqhKNyLF2lR/cOfpaH7umXZlZEhIHf7gQ== "@algolia/cache-in-memory@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/cache-in-memory/-/cache-in-memory-4.15.0.tgz#77cac4db36a0aa0837f7a7ceb760188191e35268" integrity sha512-B9mg1wd7CKMfpkbiTQ8KlcKkH6ut/goVaI6XmDCUczOOqeuZlV34tuEi7o3Xo1j66KWr/d9pMjjGYcoVPCVeOA== dependencies: "@algolia/cache-common" "4.15.0" "@algolia/client-account@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.15.0.tgz#8e0723052169665b4449dc2f8bcf3075feb6a424" integrity sha512-8wqI33HRZy5ydfFt6F5vMhtkOiAUhVfSCYXx4U3Go5RALqWLgVUp6wzOo0mr1z08POCkHDpbQMQvyayb1CZ/kw== dependencies: "@algolia/client-common" "4.15.0" "@algolia/client-search" "4.15.0" "@algolia/transporter" "4.15.0" "@algolia/client-analytics@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-4.15.0.tgz#6b8fe450e1bba114b0d0598cbf9acac482798a36" integrity sha512-jrPjEeNEIIQKeA1XCZXx3f3aybtwF7wjYlnfHbLARuZ9AuHzimOKjX0ZwqvMmvTsHivpcZ2rqY+j1E8HoH1ELA== dependencies: "@algolia/client-common" "4.15.0" "@algolia/client-search" "4.15.0" "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" "@algolia/client-common@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.15.0.tgz#27dd9441aedf481736696d519e55ea8e2f5a4432" integrity sha512-PlsJMObZuYw4JlG5EhYv1PHDOv7n5mD5PzqFyoNfSOYaEPRZepa3W579ya29yOu3FZ0VGMNJmB7Q5v/+/fwvIw== dependencies: "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" "@algolia/client-personalization@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-4.15.0.tgz#6f10eda827d2607ab6c2341464cd35107bf8cf99" integrity sha512-Bf0bhRAiNL9LWurzyHRH8UBi4fDt3VbCNkInxVngKQT1uCZWXecwoPWGhcSSpdanBqFJA/1WBt+BWx7a50Bhlg== dependencies: "@algolia/client-common" "4.15.0" "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" "@algolia/client-search@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.15.0.tgz#2d849faae7943fcc983ac923eac767666a9e6a9a" integrity sha512-dTwZD4u53WdmexnMcoO2Qd/+YCP3ESXKOtD2MryQ1a9dHwB2Y3Qob0kyS1PG82idwM3enbznvscI9Sf4o9PUWQ== dependencies: "@algolia/client-common" "4.15.0" "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" "@algolia/logger-common@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.15.0.tgz#a2cf3d3abbdd00594006164302600ba46d75059f" integrity sha512-D8OFwn/HpvQz66goIcjxOKsYBMuxiruxJ3cA/bnc0EiDvSA2P2z6bNQWgS5gbstuTZIJmbhr+53NyOxFkmMNAA== "@algolia/logger-console@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/logger-console/-/logger-console-4.15.0.tgz#8a0948b0c16ad546af9dd14b9021f21f42737c97" integrity sha512-pQOvVaRSEJQJRXKTnxEA6nN1hipSQadJJ4einw0nIlfMOGZh/kps1ybh8vRUlUGyfEuN/3dyFs0W3Ac7hIItlg== dependencies: "@algolia/logger-common" "4.15.0" "@algolia/requester-browser-xhr@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.15.0.tgz#38b5956d01408ad4291d89915df921ff8534cca6" integrity sha512-va186EfALF+6msYZXaoBSxcnFCg3SoWJ+uv1yMyhQRJRe7cZSHWSVT3s40vmar90gxlBu80KMVwVlsvJhJv6ew== dependencies: "@algolia/requester-common" "4.15.0" "@algolia/requester-common@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.15.0.tgz#c68ad3dccc1de71b5be9b08a07e2baf58ec49d82" integrity sha512-w0UUzxElbo4hrKg4QP/jiXDNbIJuAthxdlkos9nS8KAPK2XI3R9BlUjLz/ZVs4F9TDGI0mhjrNHhZ12KXcoyhg== "@algolia/requester-node-http@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.15.0.tgz#02f841586e620c7b4e4e555f315cd52dd815f330" integrity sha512-eeEOhFtgwKcgAlKAZpgBRZJ0ILSEBCXxZ9uwfVWPD24W1b6z08gVoTJ6J7lCeCnJmudg+tMElDnGzHkjup9CJA== dependencies: "@algolia/requester-common" "4.15.0" "@algolia/transporter@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.15.0.tgz#c65c512206c66aadc2897337220ae5454001967e" integrity sha512-JoWR+ixG3EmA0UPntQFN/FV5TasYcYu93d5+oKzHFeZ6Z7rtW5Im9iy/Oh/ggk1AAN5fTdqKewtbBpdaYDbKsQ== dependencies: "@algolia/cache-common" "4.15.0" "@algolia/logger-common" "4.15.0" "@algolia/requester-common" "4.15.0" algoliasearch@^4.15.0: version "4.15.0" resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.15.0.tgz#8279576f06667a1d0705e8c22a17daa8e707b469" integrity sha512-+vgKQF5944dYsz9zhKk07JbOYeNdKisoD5GeG0woBL3nLzbn2a+nGwki60DXg7CXvaFXBcTXyJG4C+VaBVd44g== dependencies: "@algolia/cache-browser-local-storage" "4.15.0" "@algolia/cache-common" "4.15.0" "@algolia/cache-in-memory" "4.15.0" "@algolia/client-account" "4.15.0" "@algolia/client-analytics" "4.15.0" "@algolia/client-common" "4.15.0" "@algolia/client-personalization" "4.15.0" "@algolia/client-search" "4.15.0" "@algolia/logger-common" "4.15.0" "@algolia/logger-console" "4.15.0" "@algolia/requester-browser-xhr" "4.15.0" "@algolia/requester-common" "4.15.0" "@algolia/requester-node-http" "4.15.0" "@algolia/transporter" "4.15.0"