frontman-ssg 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +42 -0
  3. data/.github/CODE_OF_CONDUCT.md +9 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +25 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  7. data/.gitignore +5 -0
  8. data/.rubocop.yml +88 -0
  9. data/CHANGELOG.md +11 -0
  10. data/CONTRIBUTING.md +42 -0
  11. data/Gemfile +5 -0
  12. data/LICENSE.md +21 -0
  13. data/Rakefile +94 -0
  14. data/SECURITY.md +6 -0
  15. data/bin/frontman +6 -0
  16. data/frontman-ssg.gemspec +48 -0
  17. data/frontman.svg +2 -0
  18. data/lib/frontman.rb +15 -0
  19. data/lib/frontman/app.rb +175 -0
  20. data/lib/frontman/bootstrapper.rb +70 -0
  21. data/lib/frontman/builder/asset_pipeline.rb +55 -0
  22. data/lib/frontman/builder/builder.rb +193 -0
  23. data/lib/frontman/builder/file.rb +55 -0
  24. data/lib/frontman/builder/mapping.rb +54 -0
  25. data/lib/frontman/builder/statistics_collector.rb +37 -0
  26. data/lib/frontman/cli.rb +6 -0
  27. data/lib/frontman/commands/build.rb +76 -0
  28. data/lib/frontman/commands/init.rb +58 -0
  29. data/lib/frontman/commands/serve.rb +110 -0
  30. data/lib/frontman/concerns/dispatch_events.rb +56 -0
  31. data/lib/frontman/concerns/forward_calls_to_app.rb +28 -0
  32. data/lib/frontman/config.rb +52 -0
  33. data/lib/frontman/context.rb +125 -0
  34. data/lib/frontman/custom_struct.rb +44 -0
  35. data/lib/frontman/data_store.rb +106 -0
  36. data/lib/frontman/data_store_file.rb +60 -0
  37. data/lib/frontman/helpers/app_helper.rb +18 -0
  38. data/lib/frontman/helpers/link_helper.rb +35 -0
  39. data/lib/frontman/helpers/render_helper.rb +76 -0
  40. data/lib/frontman/helpers/url_helper.rb +11 -0
  41. data/lib/frontman/iterator.rb +48 -0
  42. data/lib/frontman/process/chain.rb +43 -0
  43. data/lib/frontman/process/processor.rb +11 -0
  44. data/lib/frontman/renderers/erb_renderer.rb +21 -0
  45. data/lib/frontman/renderers/haml_renderer.rb +22 -0
  46. data/lib/frontman/renderers/markdown_renderer.rb +26 -0
  47. data/lib/frontman/renderers/renderer.rb +26 -0
  48. data/lib/frontman/renderers/renderer_resolver.rb +26 -0
  49. data/lib/frontman/resource.rb +279 -0
  50. data/lib/frontman/sitemap_tree.rb +211 -0
  51. data/lib/frontman/toolbox/timer.rb +49 -0
  52. data/lib/frontman/version.rb +6 -0
  53. data/project-templates/default/.gitignore +2 -0
  54. data/project-templates/default/Gemfile +3 -0
  55. data/project-templates/default/config.rb +17 -0
  56. data/project-templates/default/data/site.yml +4 -0
  57. data/project-templates/default/helpers/site_helper.rb +7 -0
  58. data/project-templates/default/public/code.css +77 -0
  59. data/project-templates/default/public/frontman-logo.svg +2 -0
  60. data/project-templates/default/public/main.css +27 -0
  61. data/project-templates/default/public/main.js +1 -0
  62. data/project-templates/default/source/index.html.md.erb +7 -0
  63. data/project-templates/default/source/sitemap.xml.erb +11 -0
  64. data/project-templates/default/views/layouts/main.erb +19 -0
  65. data/project-templates/default/views/layouts/main.haml +15 -0
  66. data/project-templates/default/views/partials/menu.erb +7 -0
  67. data/project-templates/webpack/.gitignore +4 -0
  68. data/project-templates/webpack/Gemfile +3 -0
  69. data/project-templates/webpack/README.md +54 -0
  70. data/project-templates/webpack/assets/css/code.css +77 -0
  71. data/project-templates/webpack/assets/css/style.css +27 -0
  72. data/project-templates/webpack/assets/images/.gitkeep +0 -0
  73. data/project-templates/webpack/assets/images/frontman_logo.svg +2 -0
  74. data/project-templates/webpack/assets/js/index.js +1 -0
  75. data/project-templates/webpack/config.rb +24 -0
  76. data/project-templates/webpack/data/site.yml +4 -0
  77. data/project-templates/webpack/helpers/assets_helper.rb +24 -0
  78. data/project-templates/webpack/helpers/site_helper.rb +7 -0
  79. data/project-templates/webpack/package-lock.json +7603 -0
  80. data/project-templates/webpack/package.json +34 -0
  81. data/project-templates/webpack/source/index.html.md.erb +7 -0
  82. data/project-templates/webpack/source/sitemap.xml.erb +11 -0
  83. data/project-templates/webpack/views/layouts/main.erb +20 -0
  84. data/project-templates/webpack/views/layouts/main.haml +14 -0
  85. data/project-templates/webpack/views/partials/menu.erb +7 -0
  86. data/project-templates/webpack/views/partials/script_with_vendors.haml +5 -0
  87. data/project-templates/webpack/webpack/base.config.js +51 -0
  88. data/project-templates/webpack/webpack/dev.config.js +6 -0
  89. data/project-templates/webpack/webpack/prod.config.js +30 -0
  90. data/readme.md +80 -0
  91. data/sorbet/config +2 -0
  92. data/sorbet/rbi/hidden-definitions/errors.txt +27259 -0
  93. data/sorbet/rbi/hidden-definitions/hidden.rbi +45122 -0
  94. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +276 -0
  95. data/sorbet/rbi/todo.rbi +6 -0
  96. data/spec/frontman/app_spec.rb +48 -0
  97. data/spec/frontman/bootstrapper_spec.rb +26 -0
  98. data/spec/frontman/builder/builder_spec.rb +79 -0
  99. data/spec/frontman/builder/file_spec.rb +45 -0
  100. data/spec/frontman/builder/mapping_spec.rb +8 -0
  101. data/spec/frontman/concerns/dispatch_events_spec.rb +70 -0
  102. data/spec/frontman/concerns/forward_calls_to_app_spec.rb +21 -0
  103. data/spec/frontman/config_spec.rb +54 -0
  104. data/spec/frontman/context_spec.rb +48 -0
  105. data/spec/frontman/custom_struct_spec.rb +51 -0
  106. data/spec/frontman/data_store_file_spec.rb +9 -0
  107. data/spec/frontman/data_store_spec.rb +36 -0
  108. data/spec/frontman/frontman_ssg_spec.rb +7 -0
  109. data/spec/frontman/helpers/app_helper_spec.rb +24 -0
  110. data/spec/frontman/helpers/link_helper_spec.rb +37 -0
  111. data/spec/frontman/helpers/render_helper_spec.rb +55 -0
  112. data/spec/frontman/helpers/url_helper_spec.rb +21 -0
  113. data/spec/frontman/iterator_spec.rb +47 -0
  114. data/spec/frontman/mocks/asset.css +3 -0
  115. data/spec/frontman/mocks/config.rb +0 -0
  116. data/spec/frontman/mocks/helpers/formatting_helper.rb +5 -0
  117. data/spec/frontman/mocks/helpers/language_helper.rb +5 -0
  118. data/spec/frontman/mocks/helpers/link_helper.rb +5 -0
  119. data/spec/frontman/mocks/helpers/test_command.rb +5 -0
  120. data/spec/frontman/mocks/html_file.html +8 -0
  121. data/spec/frontman/mocks/html_file.html.md.erb +9 -0
  122. data/spec/frontman/mocks/html_file.md.html +8 -0
  123. data/spec/frontman/mocks/info.yml +4 -0
  124. data/spec/frontman/mocks/layouts/raw_without_body.haml +1 -0
  125. data/spec/frontman/mocks/nested/data.yml +4 -0
  126. data/spec/frontman/mocks/nested/more_data.yml +4 -0
  127. data/spec/frontman/mocks/partials/paragraph.haml +2 -0
  128. data/spec/frontman/mocks/snippet/html_file.html +8 -0
  129. data/spec/frontman/mocks/snippet/html_file.yml +670 -0
  130. data/spec/frontman/mocks/test.html +8 -0
  131. data/spec/frontman/mocks/wrap.haml +3 -0
  132. data/spec/frontman/process/chain_spec.rb +56 -0
  133. data/spec/frontman/renderers/erb_renderer_spec.rb +22 -0
  134. data/spec/frontman/renderers/haml_renderer_spec.rb +12 -0
  135. data/spec/frontman/renderers/markdown_renderer_spec.rb +12 -0
  136. data/spec/frontman/renderers/renderer_spec.rb +16 -0
  137. data/spec/frontman/resource_spec.rb +151 -0
  138. data/spec/frontman/sitemap_tree_spec.rb +128 -0
  139. data/spec/frontman/toolbox/timer_spec.rb +34 -0
  140. data/spec/spec_setup.rb +19 -0
  141. metadata +507 -0
@@ -0,0 +1,47 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require './spec/spec_setup'
5
+ require 'parallel'
6
+ require 'frontman/config'
7
+ require 'frontman/iterator'
8
+
9
+ describe Frontman::Iterator do
10
+ before(:each) do
11
+ Frontman::Config.all.keys.each do |key|
12
+ Frontman::Config.delete(key)
13
+ end
14
+ end
15
+
16
+ it 'should run in parallel by default' do
17
+ expect(Parallel).to receive(:map)
18
+
19
+ Frontman::Iterator.map []
20
+ end
21
+
22
+ it 'should not run in parallel if config says so' do
23
+ expect(Parallel).to_not receive(:map)
24
+ Frontman::Config.set :parallel, false
25
+
26
+ Frontman::Iterator.map []
27
+ end
28
+
29
+ context 'processor count' do
30
+ it 'should take the config value if not running in parallel' do
31
+ Frontman::Config.set :parallel, false
32
+ Frontman::Config.set :processor_count, 2
33
+
34
+ expect(Frontman::Iterator.processor_count).to eq 2
35
+ end
36
+
37
+ it 'should use Parallels method if running in parallel' do
38
+ expect(Frontman::Iterator.processor_count).to eq Parallel.processor_count
39
+ end
40
+
41
+ it 'should default to 1 if not running in parallel and no config is provided' do
42
+ Frontman::Config.set :parallel, false
43
+
44
+ expect(Frontman::Iterator.processor_count).to eq 1
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ body {
2
+ color: green;
3
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module FormattingHelper
5
+ end
@@ -0,0 +1,5 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module LanguageHelper
5
+ end
@@ -0,0 +1,5 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module LinkHelper
5
+ end
@@ -0,0 +1,5 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module TestCommand
5
+ end
@@ -0,0 +1,8 @@
1
+
2
+ <!DOCTYPE html> <html lang=en> <head> <title> Quick Start | Magento 1 extension | Algolia Documentation </title>
3
+ </head> <body class=relative><main class='lg:max-w-648 min-h-full w-full'> <div class='text-grey-1000 leading-normal'> <section class=mb-48> <div class="mb-4 flex justify-between"> <div class="text-xs leading-tight"> <div class="font-sans-alt uppercase font-semibold tracking-wide"> Integrations / Extensions / <span class=text-nebula-500>Magento 1</span> </div> </div> <div class="flex items-center uppercase font-semibold tracking-wide text-grey-1000-opacity-30 text-xs leading-tight whitespace-no-wrap font-sans-alt"> <span class="block mr-4 w-16 h-16 fill-current"> <span class="block p-2"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><path d="M11,22A11,11,0,1,1,22,11,11,11,0,0,1,11,22ZM11,2a9,9,0,1,0,9,9A9,9,0,0,0,11,2Z"/><path d="M15,14a.93.93,0,0,1-.45-.11l-4-2A1,1,0,0,1,10,11V5a1,1,0,0,1,2,0v5.38l3.45,1.73a1,1,0,0,1,.44,1.34A1,1,0,0,1,15,14Z"/></svg> </span> </span> Feb. 15, 2019 </div> </div> <div class="flex justify-between"> <h1 class="md:text-4xl lg:text-5xl text-3xl leading-tall tracking-tight font-bold hyphenated"> Quick Start </h1> <div class="mt-16 ml-16"> <a class='edit-link w-24 h-24 items-center justify-center bg-grey-400-opacity-40 hover:bg-grey-400-opacity-60 rounded-full transition-fast-out hidden' href='https://github.com/algolia/doc/edit/master/source/doc/integration/magento-1/1-getting-started/1-quick-start.html.md.erb' rel=noopener target=_blank> <span class='flex items-center justify-center w-16 h-16 text-grey-700 fill-current'> <svg class=h-full xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.58 31.77"><path d="M16.29,0a16.29,16.29,0,0,0-5.15,31.75c.82.15,1.11-.36,1.11-.79s0-1.41,0-2.77C7.7,29.18,6.74,26,6.74,26a4.36,4.36,0,0,0-1.81-2.39c-1.47-1,.12-1,.12-1a3.43,3.43,0,0,1,2.49,1.68,3.48,3.48,0,0,0,4.74,1.36,3.46,3.46,0,0,1,1-2.18c-3.62-.41-7.42-1.81-7.42-8a6.3,6.3,0,0,1,1.67-4.37,5.94,5.94,0,0,1,.16-4.31s1.37-.44,4.48,1.67a15.41,15.41,0,0,1,8.16,0c3.11-2.11,4.47-1.67,4.47-1.67A5.91,5.91,0,0,1,25,11.07a6.3,6.3,0,0,1,1.67,4.37c0,6.26-3.81,7.63-7.44,8a3.85,3.85,0,0,1,1.11,3c0,2.18,0,3.94,0,4.47s.29.94,1.12.78A16.29,16.29,0,0,0,16.29,0Z"/></svg> <span aria-hidden=true class=hidden> Edit this guide </span> </span> </a> </div> </div> </section> <div class='content mb-32'> <section> <p>To get started using Algolia in your Magento installation, just follow the steps in this video or on the page below.</p> <div class="flex transition-fast-in-out items-center" data-video=true> <div class="group embed flex-no-grow flex-no-shrink md:w-248 border-l-4 border-solid border-red-500-opacity-80 shadow-md rounded-r overflow-hidden mt-0 mb-0 transition-fast-in-out" data-video-container=DUuv9ALS5cM> <div class=embed-item data-video-frame=DUuv9ALS5cM data-video-start=0 id=DUuv9ALS5cM></div> <div class="absolute pin bg-center bg-cover pointer-events-none flex items-center justify-center" data-video-thumbnail=true style="background-image: url(https://img.youtube.com/vi/DUuv9ALS5cM/hqdefault.jpg)"> <div class="py-16 px-32 rounded-lg bg-gradient-red-400-red-500 shadow group-hover:shadow-md cursor-pointer transition-fast-out"> <div class="m-4 h-24 text-white"> <div class="h-full fill-current"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 10"><polygon points="0 0 0 10 8 5 0 0"/></svg> </div> </div> </div> </div> </div> <div class="ml-32 md:block hidden" data-video-description=true> <div> <div class="mb-8 text-grey-1000 font-bold text-lg"> Algolia Instant Search on your Magento Store </div> <div class=text-grey-400> By Algolia, 17 min </div> </div> </div> </div> <h2 id=installation>Installation</h2> <p>There are two possible ways to install the extension:</p> <ol> <li>Through <a href="https://github.com/colinmollenhour/modman">modman</a></li> <li>Through <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a></li> </ol> <h3 id=modman>Modman</h3> <p>With <a href="https://github.com/colinmollenhour/modman">modman</a> installed, run the following commands:</p> <div class=snippet-wrapper><div class=snippet-actions markdown=0><div class="copy-link snippet-action btn-satellite btn-satellite-white ml-8">Copy</div></div><div class=snippet-header><div class="nav nav-tabs snippet-tabs" markdown=0><span class="snippet-tab-wrapper snippet-tab-wrapper-active"><a href="#snippet_bash" data-toggle=tab class=snippet-tab>bash</a></span></div></div><div id=snippet_bash data-tab-pane class="snippet-body snippet-body-active" data-active=true data-language=bash><div class=highlight><pre class="highlight shell"><code><span class="nb">cd</span> /path/to/your/magento/directory
4
+ modman init
5
+ modman clone https://github.com/algolia/algoliasearch-magento.git
6
+ </code></pre></div></div></div> <h3 id=magento-marketplace>Magento Marketplace</h3> <p>Navigate to the <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a> to get the extension and follow the instructions to install.</p> <h2 id=configuration>Configuration</h2> <p>Before Algolia can be used with Magento, an Algolia account is needed. With the account, it’s possible to configure the Magento extension to work properly.</p> <h3 id=algolia-account>Algolia account</h3> <p>An account can be created in the <a href="/users/sign_up">sign-up wizard</a>.</p> <p class="alert alert-info">Pay attention while picking a data center during the sign-up. For performance reasons, it’s best to pick the one closest to the data center of your Magento installation.</p> <h3 id=magento-settings>Magento settings</h3> <p>To configure the Magento extension, you will need the following Algolia credentials:</p> <ul> <li>Application ID</li> <li><a href="/doc/guides/security/api-keys/#search-only-api-key">Search-only API key</a></li> <li><a href="/doc/guides/security/api-keys/#admin-api-key">Admin API key</a></li> </ul> <p>These credentials can be found on the <a href="/dashboard">Algolia Dashboard</a>, on the <strong>API keys</strong> page from the menu.</p> <p>In the administration section of your Magento project, navigate to <strong>System &gt; Configuration &gt; Catalog &gt; Algolia Search</strong> and fill in the form with all the information required.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/configuration-ef05486e.png" alt="Basic information configuration"/></p> </figure> </section> <section> <h2 id=indexing>Indexing</h2> <p>With the extension configured, the data in your Magento installation should be pushed to Algolia for the first time by a process called <a href="/doc/guides/getting-started/how-algolia-works/in-depth/implementation-process/#indexing-data"><em>indexing</em></a>. This can be accomplished by navigating to <strong>System &gt; Indexing Management</strong>. On this page, a list of indices will show up for which the <strong>Reindex Data</strong> link has to be clicked:</p> <ul> <li>Algolia Search Products</li> <li>Algolia Search Categories</li> <li>Algolia Search Pages</li> <li>Algolia Search Suggestions</li> </ul> <p>When the indexing is done, the search should now be available in your Magento installation.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/indexers-a88f04f2.png" alt="Magento store indexers"/></p> </figure> </section> </div> <div class=mt-88>
7
+ </div></div></main></body>
8
+ </html>
@@ -0,0 +1,9 @@
1
+
2
+ <!DOCTYPE html> <html lang=en> <head> <title> Quick Start | Magento 1 extension | Algolia Documentation </title>
3
+ </head> <body class=relative><main class='lg:max-w-648 min-h-full w-full'> <div class='text-grey-1000 leading-normal'> <section class=mb-48> <div class="mb-4 flex justify-between"> <div class="text-xs leading-tight"> <div class="font-sans-alt uppercase font-semibold tracking-wide"> Integrations / Extensions / <span class=text-nebula-500>Magento 1</span> </div> </div> <div class="flex items-center uppercase font-semibold tracking-wide text-grey-1000-opacity-30 text-xs leading-tight whitespace-no-wrap font-sans-alt"> <span class="block mr-4 w-16 h-16 fill-current"> <span class="block p-2"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><path d="M11,22A11,11,0,1,1,22,11,11,11,0,0,1,11,22ZM11,2a9,9,0,1,0,9,9A9,9,0,0,0,11,2Z"/><path d="M15,14a.93.93,0,0,1-.45-.11l-4-2A1,1,0,0,1,10,11V5a1,1,0,0,1,2,0v5.38l3.45,1.73a1,1,0,0,1,.44,1.34A1,1,0,0,1,15,14Z"/></svg> </span> </span> Feb. 15, 2019 </div> </div> <div class="flex justify-between"> <h1 class="md:text-4xl lg:text-5xl text-3xl leading-tall tracking-tight font-bold hyphenated"> Quick Start </h1> <div class="mt-16 ml-16"> <a class='edit-link w-24 h-24 items-center justify-center bg-grey-400-opacity-40 hover:bg-grey-400-opacity-60 rounded-full transition-fast-out hidden' href='https://github.com/algolia/doc/edit/master/source/doc/integration/magento-1/1-getting-started/1-quick-start.html.md.erb' rel=noopener target=_blank> <span class='flex items-center justify-center w-16 h-16 text-grey-700 fill-current'> <svg class=h-full xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.58 31.77"><path d="M16.29,0a16.29,16.29,0,0,0-5.15,31.75c.82.15,1.11-.36,1.11-.79s0-1.41,0-2.77C7.7,29.18,6.74,26,6.74,26a4.36,4.36,0,0,0-1.81-2.39c-1.47-1,.12-1,.12-1a3.43,3.43,0,0,1,2.49,1.68,3.48,3.48,0,0,0,4.74,1.36,3.46,3.46,0,0,1,1-2.18c-3.62-.41-7.42-1.81-7.42-8a6.3,6.3,0,0,1,1.67-4.37,5.94,5.94,0,0,1,.16-4.31s1.37-.44,4.48,1.67a15.41,15.41,0,0,1,8.16,0c3.11-2.11,4.47-1.67,4.47-1.67A5.91,5.91,0,0,1,25,11.07a6.3,6.3,0,0,1,1.67,4.37c0,6.26-3.81,7.63-7.44,8a3.85,3.85,0,0,1,1.11,3c0,2.18,0,3.94,0,4.47s.29.94,1.12.78A16.29,16.29,0,0,0,16.29,0Z"/></svg> <span aria-hidden=true class=hidden> Edit this guide </span> </span> </a> </div> </div> </section> <div class='content mb-32'> <section> <p>To get started using Algolia in your Magento installation, just follow the steps in this video or on the page below.</p> <div class="flex transition-fast-in-out items-center" data-video=true> <div class="group embed flex-no-grow flex-no-shrink md:w-248 border-l-4 border-solid border-red-500-opacity-80 shadow-md rounded-r overflow-hidden mt-0 mb-0 transition-fast-in-out" data-video-container=DUuv9ALS5cM> <div class=embed-item data-video-frame=DUuv9ALS5cM data-video-start=0 id=DUuv9ALS5cM></div> <div class="absolute pin bg-center bg-cover pointer-events-none flex items-center justify-center" data-video-thumbnail=true style="background-image: url(https://img.youtube.com/vi/DUuv9ALS5cM/hqdefault.jpg)"> <div class="py-16 px-32 rounded-lg bg-gradient-red-400-red-500 shadow group-hover:shadow-md cursor-pointer transition-fast-out"> <div class="m-4 h-24 text-white"> <div class="h-full fill-current"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 10"><polygon points="0 0 0 10 8 5 0 0"/></svg> </div> </div> </div> </div> </div> <div class="ml-32 md:block hidden" data-video-description=true> <div> <div class="mb-8 text-grey-1000 font-bold text-lg"> Algolia Instant Search on your Magento Store </div> <div class=text-grey-400> By Algolia, 17 min </div> </div> </div> </div> <h2 id=installation>Installation</h2> <p>There are two possible ways to install the extension:</p> <ol> <li>Through <a href="https://github.com/colinmollenhour/modman">modman</a></li> <li>Through <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a></li> </ol> <h3 id=modman>Modman</h3> <p>With <a href="https://github.com/colinmollenhour/modman">modman</a> installed, run the following commands:</p> <div class=snippet-wrapper><div class=snippet-actions markdown=0><div class="copy-link snippet-action btn-satellite btn-satellite-white ml-8">Copy</div></div><div class=snippet-header><div class="nav nav-tabs snippet-tabs" markdown=0><span class="snippet-tab-wrapper snippet-tab-wrapper-active"><a href="#snippet_bash" data-toggle=tab class=snippet-tab>bash</a></span></div></div><div id=snippet_bash data-tab-pane class="snippet-body snippet-body-active" data-active=true data-language=bash><div class=highlight><pre class="highlight shell"><code><span class="nb">cd</span> /path/to/your/magento/directory
4
+ modman init
5
+ modman clone https://github.com/algolia/algoliasearch-magento.git
6
+ <%= 'testing erb' %>
7
+ </code></pre></div></div></div> <h3 id=magento-marketplace>Magento Marketplace</h3> <p>Navigate to the <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a> to get the extension and follow the instructions to install.</p> <h2 id=configuration>Configuration</h2> <p>Before Algolia can be used with Magento, an Algolia account is needed. With the account, it’s possible to configure the Magento extension to work properly.</p> <h3 id=algolia-account>Algolia account</h3> <p>An account can be created in the <a href="/users/sign_up">sign-up wizard</a>.</p> <p class="alert alert-info">Pay attention while picking a data center during the sign-up. For performance reasons, it’s best to pick the one closest to the data center of your Magento installation.</p> <h3 id=magento-settings>Magento settings</h3> <p>To configure the Magento extension, you will need the following Algolia credentials:</p> <ul> <li>Application ID</li> <li><a href="/doc/guides/security/api-keys/#search-only-api-key">Search-only API key</a></li> <li><a href="/doc/guides/security/api-keys/#admin-api-key">Admin API key</a></li> </ul> <p>These credentials can be found on the <a href="/dashboard">Algolia Dashboard</a>, on the <strong>API keys</strong> page from the menu.</p> <p>In the administration section of your Magento project, navigate to <strong>System &gt; Configuration &gt; Catalog &gt; Algolia Search</strong> and fill in the form with all the information required.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/configuration-ef05486e.png" alt="Basic information configuration"/></p> </figure> </section> <section> <h2 id=indexing>Indexing</h2> <p>With the extension configured, the data in your Magento installation should be pushed to Algolia for the first time by a process called <a href="/doc/guides/getting-started/how-algolia-works/in-depth/implementation-process/#indexing-data"><em>indexing</em></a>. This can be accomplished by navigating to <strong>System &gt; Indexing Management</strong>. On this page, a list of indices will show up for which the <strong>Reindex Data</strong> link has to be clicked:</p> <ul> <li>Algolia Search Products</li> <li>Algolia Search Categories</li> <li>Algolia Search Pages</li> <li>Algolia Search Suggestions</li> </ul> <p>When the indexing is done, the search should now be available in your Magento installation.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/indexers-a88f04f2.png" alt="Magento store indexers"/></p> </figure> </section> </div> <div class=mt-88>
8
+ </div></div></main></body>
9
+ </html>
@@ -0,0 +1,8 @@
1
+
2
+ <!DOCTYPE html> <html lang=en> <head> <title> Quick Start | Magento 1 extension | Algolia Documentation </title>
3
+ </head> <body class=relative><main class='lg:max-w-648 min-h-full w-full'> <div class='text-grey-1000 leading-normal'> <section class=mb-48> <div class="mb-4 flex justify-between"> <div class="text-xs leading-tight"> <div class="font-sans-alt uppercase font-semibold tracking-wide"> Integrations / Extensions / <span class=text-nebula-500>Magento 1</span> </div> </div> <div class="flex items-center uppercase font-semibold tracking-wide text-grey-1000-opacity-30 text-xs leading-tight whitespace-no-wrap font-sans-alt"> <span class="block mr-4 w-16 h-16 fill-current"> <span class="block p-2"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><path d="M11,22A11,11,0,1,1,22,11,11,11,0,0,1,11,22ZM11,2a9,9,0,1,0,9,9A9,9,0,0,0,11,2Z"/><path d="M15,14a.93.93,0,0,1-.45-.11l-4-2A1,1,0,0,1,10,11V5a1,1,0,0,1,2,0v5.38l3.45,1.73a1,1,0,0,1,.44,1.34A1,1,0,0,1,15,14Z"/></svg> </span> </span> Feb. 15, 2019 </div> </div> <div class="flex justify-between"> <h1 class="md:text-4xl lg:text-5xl text-3xl leading-tall tracking-tight font-bold hyphenated"> Quick Start </h1> <div class="mt-16 ml-16"> <a class='edit-link w-24 h-24 items-center justify-center bg-grey-400-opacity-40 hover:bg-grey-400-opacity-60 rounded-full transition-fast-out hidden' href='https://github.com/algolia/doc/edit/master/source/doc/integration/magento-1/1-getting-started/1-quick-start.html.md.erb' rel=noopener target=_blank> <span class='flex items-center justify-center w-16 h-16 text-grey-700 fill-current'> <svg class=h-full xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.58 31.77"><path d="M16.29,0a16.29,16.29,0,0,0-5.15,31.75c.82.15,1.11-.36,1.11-.79s0-1.41,0-2.77C7.7,29.18,6.74,26,6.74,26a4.36,4.36,0,0,0-1.81-2.39c-1.47-1,.12-1,.12-1a3.43,3.43,0,0,1,2.49,1.68,3.48,3.48,0,0,0,4.74,1.36,3.46,3.46,0,0,1,1-2.18c-3.62-.41-7.42-1.81-7.42-8a6.3,6.3,0,0,1,1.67-4.37,5.94,5.94,0,0,1,.16-4.31s1.37-.44,4.48,1.67a15.41,15.41,0,0,1,8.16,0c3.11-2.11,4.47-1.67,4.47-1.67A5.91,5.91,0,0,1,25,11.07a6.3,6.3,0,0,1,1.67,4.37c0,6.26-3.81,7.63-7.44,8a3.85,3.85,0,0,1,1.11,3c0,2.18,0,3.94,0,4.47s.29.94,1.12.78A16.29,16.29,0,0,0,16.29,0Z"/></svg> <span aria-hidden=true class=hidden> Edit this guide </span> </span> </a> </div> </div> </section> <div class='content mb-32'> <section> <p>To get started using Algolia in your Magento installation, just follow the steps in this video or on the page below.</p> <div class="flex transition-fast-in-out items-center" data-video=true> <div class="group embed flex-no-grow flex-no-shrink md:w-248 border-l-4 border-solid border-red-500-opacity-80 shadow-md rounded-r overflow-hidden mt-0 mb-0 transition-fast-in-out" data-video-container=DUuv9ALS5cM> <div class=embed-item data-video-frame=DUuv9ALS5cM data-video-start=0 id=DUuv9ALS5cM></div> <div class="absolute pin bg-center bg-cover pointer-events-none flex items-center justify-center" data-video-thumbnail=true style="background-image: url(https://img.youtube.com/vi/DUuv9ALS5cM/hqdefault.jpg)"> <div class="py-16 px-32 rounded-lg bg-gradient-red-400-red-500 shadow group-hover:shadow-md cursor-pointer transition-fast-out"> <div class="m-4 h-24 text-white"> <div class="h-full fill-current"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 10"><polygon points="0 0 0 10 8 5 0 0"/></svg> </div> </div> </div> </div> </div> <div class="ml-32 md:block hidden" data-video-description=true> <div> <div class="mb-8 text-grey-1000 font-bold text-lg"> Algolia Instant Search on your Magento Store </div> <div class=text-grey-400> By Algolia, 17 min </div> </div> </div> </div> <h2 id=installation>Installation</h2> <p>There are two possible ways to install the extension:</p> <ol> <li>Through <a href="https://github.com/colinmollenhour/modman">modman</a></li> <li>Through <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a></li> </ol> <h3 id=modman>Modman</h3> <p>With <a href="https://github.com/colinmollenhour/modman">modman</a> installed, run the following commands:</p> <div class=snippet-wrapper><div class=snippet-actions markdown=0><div class="copy-link snippet-action btn-satellite btn-satellite-white ml-8">Copy</div></div><div class=snippet-header><div class="nav nav-tabs snippet-tabs" markdown=0><span class="snippet-tab-wrapper snippet-tab-wrapper-active"><a href="#snippet_bash" data-toggle=tab class=snippet-tab>bash</a></span></div></div><div id=snippet_bash data-tab-pane class="snippet-body snippet-body-active" data-active=true data-language=bash><div class=highlight><pre class="highlight shell"><code><span class="nb">cd</span> /path/to/your/magento/directory
4
+ modman init
5
+ modman clone https://github.com/algolia/algoliasearch-magento.git
6
+ </code></pre></div></div></div> <h3 id=magento-marketplace>Magento Marketplace</h3> <p>Navigate to the <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a> to get the extension and follow the instructions to install.</p> <h2 id=configuration>Configuration</h2> <p>Before Algolia can be used with Magento, an Algolia account is needed. With the account, it’s possible to configure the Magento extension to work properly.</p> <h3 id=algolia-account>Algolia account</h3> <p>An account can be created in the <a href="/users/sign_up">sign-up wizard</a>.</p> <p class="alert alert-info">Pay attention while picking a data center during the sign-up. For performance reasons, it’s best to pick the one closest to the data center of your Magento installation.</p> <h3 id=magento-settings>Magento settings</h3> <p>To configure the Magento extension, you will need the following Algolia credentials:</p> <ul> <li>Application ID</li> <li><a href="/doc/guides/security/api-keys/#search-only-api-key">Search-only API key</a></li> <li><a href="/doc/guides/security/api-keys/#admin-api-key">Admin API key</a></li> </ul> <p>These credentials can be found on the <a href="/dashboard">Algolia Dashboard</a>, on the <strong>API keys</strong> page from the menu.</p> <p>In the administration section of your Magento project, navigate to <strong>System &gt; Configuration &gt; Catalog &gt; Algolia Search</strong> and fill in the form with all the information required.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/configuration-ef05486e.png" alt="Basic information configuration"/></p> </figure> </section> <section> <h2 id=indexing>Indexing</h2> <p>With the extension configured, the data in your Magento installation should be pushed to Algolia for the first time by a process called <a href="/doc/guides/getting-started/how-algolia-works/in-depth/implementation-process/#indexing-data"><em>indexing</em></a>. This can be accomplished by navigating to <strong>System &gt; Indexing Management</strong>. On this page, a list of indices will show up for which the <strong>Reindex Data</strong> link has to be clicked:</p> <ul> <li>Algolia Search Products</li> <li>Algolia Search Categories</li> <li>Algolia Search Pages</li> <li>Algolia Search Suggestions</li> </ul> <p>When the indexing is done, the search should now be available in your Magento installation.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/indexers-a88f04f2.png" alt="Magento store indexers"/></p> </figure> </section> </div> <div class=mt-88>
7
+ </div></div></main></body>
8
+ </html>
@@ -0,0 +1,4 @@
1
+ name: test
2
+ types:
3
+ - test1
4
+ - test2
@@ -0,0 +1,4 @@
1
+ name: test
2
+ types:
3
+ - test1
4
+ - test2
@@ -0,0 +1,4 @@
1
+ name: test
2
+ types:
3
+ - test1
4
+ - test2
@@ -0,0 +1,2 @@
1
+ %p
2
+ = "The passed text: #{text}"
@@ -0,0 +1,8 @@
1
+
2
+ <!DOCTYPE html> <html lang=en> <head> <title> Quick Start | Magento 1 extension | Algolia Documentation </title>
3
+ </head> <body class=relative><main class='lg:max-w-648 min-h-full w-full'> <div class='text-grey-1000 leading-normal'> <section class=mb-48> <div class="mb-4 flex justify-between"> <div class="text-xs leading-tight"> <div class="font-sans-alt uppercase font-semibold tracking-wide"> Integrations / Extensions / <span class=text-nebula-500>Magento 1</span> </div> </div> <div class="flex items-center uppercase font-semibold tracking-wide text-grey-1000-opacity-30 text-xs leading-tight whitespace-no-wrap font-sans-alt"> <span class="block mr-4 w-16 h-16 fill-current"> <span class="block p-2"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><path d="M11,22A11,11,0,1,1,22,11,11,11,0,0,1,11,22ZM11,2a9,9,0,1,0,9,9A9,9,0,0,0,11,2Z"/><path d="M15,14a.93.93,0,0,1-.45-.11l-4-2A1,1,0,0,1,10,11V5a1,1,0,0,1,2,0v5.38l3.45,1.73a1,1,0,0,1,.44,1.34A1,1,0,0,1,15,14Z"/></svg> </span> </span> Feb. 15, 2019 </div> </div> <div class="flex justify-between"> <h1 class="md:text-4xl lg:text-5xl text-3xl leading-tall tracking-tight font-bold hyphenated"> Quick Start </h1> <div class="mt-16 ml-16"> <a class='edit-link w-24 h-24 items-center justify-center bg-grey-400-opacity-40 hover:bg-grey-400-opacity-60 rounded-full transition-fast-out hidden' href='https://github.com/algolia/doc/edit/master/source/doc/integration/magento-1/1-getting-started/1-quick-start.html.md.erb' rel=noopener target=_blank> <span class='flex items-center justify-center w-16 h-16 text-grey-700 fill-current'> <svg class=h-full xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.58 31.77"><path d="M16.29,0a16.29,16.29,0,0,0-5.15,31.75c.82.15,1.11-.36,1.11-.79s0-1.41,0-2.77C7.7,29.18,6.74,26,6.74,26a4.36,4.36,0,0,0-1.81-2.39c-1.47-1,.12-1,.12-1a3.43,3.43,0,0,1,2.49,1.68,3.48,3.48,0,0,0,4.74,1.36,3.46,3.46,0,0,1,1-2.18c-3.62-.41-7.42-1.81-7.42-8a6.3,6.3,0,0,1,1.67-4.37,5.94,5.94,0,0,1,.16-4.31s1.37-.44,4.48,1.67a15.41,15.41,0,0,1,8.16,0c3.11-2.11,4.47-1.67,4.47-1.67A5.91,5.91,0,0,1,25,11.07a6.3,6.3,0,0,1,1.67,4.37c0,6.26-3.81,7.63-7.44,8a3.85,3.85,0,0,1,1.11,3c0,2.18,0,3.94,0,4.47s.29.94,1.12.78A16.29,16.29,0,0,0,16.29,0Z"/></svg> <span aria-hidden=true class=hidden> Edit this guide </span> </span> </a> </div> </div> </section> <div class='content mb-32'> <section> <p>To get started using Algolia in your Magento installation, just follow the steps in this video or on the page below.</p> <div class="flex transition-fast-in-out items-center" data-video=true> <div class="group embed flex-no-grow flex-no-shrink md:w-248 border-l-4 border-solid border-red-500-opacity-80 shadow-md rounded-r overflow-hidden mt-0 mb-0 transition-fast-in-out" data-video-container=DUuv9ALS5cM> <div class=embed-item data-video-frame=DUuv9ALS5cM data-video-start=0 id=DUuv9ALS5cM></div> <div class="absolute pin bg-center bg-cover pointer-events-none flex items-center justify-center" data-video-thumbnail=true style="background-image: url(https://img.youtube.com/vi/DUuv9ALS5cM/hqdefault.jpg)"> <div class="py-16 px-32 rounded-lg bg-gradient-red-400-red-500 shadow group-hover:shadow-md cursor-pointer transition-fast-out"> <div class="m-4 h-24 text-white"> <div class="h-full fill-current"> <svg class="block h-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 10"><polygon points="0 0 0 10 8 5 0 0"/></svg> </div> </div> </div> </div> </div> <div class="ml-32 md:block hidden" data-video-description=true> <div> <div class="mb-8 text-grey-1000 font-bold text-lg"> Algolia Instant Search on your Magento Store </div> <div class=text-grey-400> By Algolia, 17 min </div> </div> </div> </div> <h2 id=installation>Installation</h2> <p>There are two possible ways to install the extension:</p> <ol> <li>Through <a href="https://github.com/colinmollenhour/modman">modman</a></li> <li>Through <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a></li> </ol> <h3 id=modman>Modman</h3> <p>With <a href="https://github.com/colinmollenhour/modman">modman</a> installed, run the following commands:</p> <div class=snippet-wrapper><div class=snippet-actions markdown=0><div class="copy-link snippet-action btn-satellite btn-satellite-white ml-8">Copy</div></div><div class=snippet-header><div class="nav nav-tabs snippet-tabs" markdown=0><span class="snippet-tab-wrapper snippet-tab-wrapper-active"><a href="#snippet_bash" data-toggle=tab class=snippet-tab>bash</a></span></div></div><div id=snippet_bash data-tab-pane class="snippet-body snippet-body-active" data-active=true data-language=bash><div class=highlight><pre class="highlight shell"><code><span class="nb">cd</span> /path/to/your/magento/directory
4
+ modman init
5
+ modman clone https://github.com/algolia/algoliasearch-magento.git
6
+ </code></pre></div></div></div> <h3 id=magento-marketplace>Magento Marketplace</h3> <p>Navigate to the <a href="https://marketplace.magento.com/algolia-algoliasearch.html">Magento Marketplace</a> to get the extension and follow the instructions to install.</p> <h2 id=configuration>Configuration</h2> <p>Before Algolia can be used with Magento, an Algolia account is needed. With the account, it’s possible to configure the Magento extension to work properly.</p> <h3 id=algolia-account>Algolia account</h3> <p>An account can be created in the <a href="/users/sign_up">sign-up wizard</a>.</p> <p class="alert alert-info">Pay attention while picking a data center during the sign-up. For performance reasons, it’s best to pick the one closest to the data center of your Magento installation.</p> <h3 id=magento-settings>Magento settings</h3> <p>To configure the Magento extension, you will need the following Algolia credentials:</p> <ul> <li>Application ID</li> <li><a href="/doc/guides/security/api-keys/#search-only-api-key">Search-only API key</a></li> <li><a href="/doc/guides/security/api-keys/#admin-api-key">Admin API key</a></li> </ul> <p>These credentials can be found on the <a href="/dashboard">Algolia Dashboard</a>, on the <strong>API keys</strong> page from the menu.</p> <p>In the administration section of your Magento project, navigate to <strong>System &gt; Configuration &gt; Catalog &gt; Algolia Search</strong> and fill in the form with all the information required.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/configuration-ef05486e.png" alt="Basic information configuration"/></p> </figure> </section> <section> <h2 id=indexing>Indexing</h2> <p>With the extension configured, the data in your Magento installation should be pushed to Algolia for the first time by a process called <a href="/doc/guides/getting-started/how-algolia-works/in-depth/implementation-process/#indexing-data"><em>indexing</em></a>. This can be accomplished by navigating to <strong>System &gt; Indexing Management</strong>. On this page, a list of indices will show up for which the <strong>Reindex Data</strong> link has to be clicked:</p> <ul> <li>Algolia Search Products</li> <li>Algolia Search Categories</li> <li>Algolia Search Pages</li> <li>Algolia Search Suggestions</li> </ul> <p>When the indexing is done, the search should now be available in your Magento installation.</p> <figure> <p><img src="/doc/assets/images/integrations/magento-1/getting-started/indexers-a88f04f2.png" alt="Magento store indexers"/></p> </figure> </section> </div> <div class=mt-88>
7
+ </div></div></main></body>
8
+ </html>
@@ -0,0 +1,670 @@
1
+ batch_multiple_indices:
2
+ android: |
3
+ ```java
4
+ List<JSONObject> array = new ArrayList<>();
5
+ array.add(new JSONObject()
6
+ .put("action", "addObject")
7
+ .put("indexName", "index1")
8
+ .put("body", new JSONObject()
9
+ .put("firstname", "Jimmie")
10
+ .put("lastname", "Barninger")
11
+ )
12
+ );
13
+
14
+ array.add(new JSONObject()
15
+ .put("action", "updateObject")
16
+ .put("indexName", "index1")
17
+ .put("body", new JSONObject()
18
+ .put("objectID", "myID2")
19
+ .put("firstname", "Max")
20
+ .put("lastname", "Barninger")
21
+ )
22
+ );
23
+
24
+ array.add(new JSONObject()
25
+ .put("action", "partialUpdateObject")
26
+ .put("indexName", "index1")
27
+ .put("body", new JSONObject()
28
+ .put("objectID", "myID3")
29
+ .put("lastname", "McFarway")
30
+ )
31
+ );
32
+
33
+ array.add(new JSONObject()
34
+ .put("action", "partialUpdateObjectNoCreate")
35
+ .put("indexName", "index1")
36
+ .put("body", new JSONObject()
37
+ .put("objectID", "myID4")
38
+ .put("firstname", "Warren")
39
+ )
40
+ );
41
+
42
+ array.add(new JSONObject()
43
+ .put("action", "deleteObject")
44
+ .put("indexName", "index2")
45
+ .put("body", new JSONObject()
46
+ .put("objectID", "myID5")
47
+ )
48
+ );
49
+
50
+ client.batchAsync(new JSONArray(array), null);
51
+ ```
52
+
53
+ csharp: |
54
+ ```csharp
55
+ List<BatchOperation<Contact>> operations = new List<BatchOperation<Contact>>
56
+ {
57
+ new BatchOperation<Contact>
58
+ {
59
+ Action = BatchActionType.AddObject,
60
+ IndexName = "index1",
61
+ Body = new Contact { FirstName = "Jimmie", LastName = "Barninger" }
62
+ },
63
+ new BatchOperation<Contact>
64
+ {
65
+ Action = BatchActionType.UpdateObject,
66
+ IndexName = "index1",
67
+ Body = new Contact { ObjectID = "myID2", FirstName = "Max", LastName = "Barninger" }
68
+ },
69
+ new BatchOperation<Contact>
70
+ {
71
+ Action = BatchActionType.PartialUpdateObject,
72
+ IndexName = "index1",
73
+ Body = new Contact { ObjectID = "myID3", LastName = "McFarway" }
74
+ },
75
+ new BatchOperation<Contact>
76
+ {
77
+ Action = BatchActionType.PartialUpdateObjectNoCreate,
78
+ IndexName = "index1",
79
+ Body = new Contact { ObjectID = "myID4", LastName = "Warren" }
80
+ },
81
+ new BatchOperation<Contact>
82
+ {
83
+ Action = BatchActionType.DeleteObject,
84
+ IndexName = "index2",
85
+ Body = new Contact { ObjectID = "myID5" }
86
+ }
87
+ };
88
+
89
+ client.MultipleBatch(operations);
90
+
91
+ // Asynchronous
92
+ client.MultipleBatchAsync(operations);
93
+ ```
94
+
95
+ go: |
96
+ ```go
97
+ operations := []algoliasearch.BatchOperationIndexed{
98
+ {
99
+ IndexName: "index1",
100
+ BatchOperation: algoliasearch.BatchOperation{
101
+ Action: "addObject",
102
+ Body: algoliasearch.Map{
103
+ "firstname": "Jimmie",
104
+ "lastname": "Barninger",
105
+ },
106
+ },
107
+ },
108
+ {
109
+ IndexName: "index1",
110
+ BatchOperation: algoliasearch.BatchOperation{
111
+ Action: "updateObject",
112
+ Body: algoliasearch.Map{
113
+ "objectID": "myID2",
114
+ "firstname": "Max",
115
+ "lastname": "Barninger",
116
+ },
117
+ },
118
+ },
119
+ {
120
+ IndexName: "index1",
121
+ BatchOperation: algoliasearch.BatchOperation{
122
+ Action: "partialUpdateObject",
123
+ Body: algoliasearch.Map{
124
+ "objectID": "myID3",
125
+ "lastname": "McFarway",
126
+ },
127
+ },
128
+ },
129
+ {
130
+ IndexName: "index1",
131
+ BatchOperation: algoliasearch.BatchOperation{
132
+ Action: "partialUpdateObjectNoCreate",
133
+ Body: algoliasearch.Map{
134
+ "objectID": "myID4",
135
+ "firstname": "Warren",
136
+ },
137
+ },
138
+ },
139
+ {
140
+ IndexName: "index2",
141
+ BatchOperation: algoliasearch.BatchOperation{
142
+ Action: "deleteObject",
143
+ Body: algoliasearch.Map{
144
+ "objectID": "myID5",
145
+ },
146
+ },
147
+ },
148
+ }
149
+
150
+ res, err := client.Batch(operations)
151
+ ```
152
+
153
+ java: |
154
+ ```java
155
+ // Sync and Async version
156
+
157
+ client.batch(Arrays.asList(
158
+ new BatchAddObjectOperation<>(
159
+ "index1",
160
+ new Contact().setFirstName("Jimmie").setLastName("Barninger")
161
+ ),
162
+ new BatchUpdateObjectOperation<>(
163
+ "index1",
164
+ new Contact().setObjectID("myID2").setFirstName("Max").setLastName("Barninger")
165
+ ),
166
+ new BatchPartialUpdateObjectOperation<>(
167
+ "index1",
168
+ new Contact().setObjectID("myID3").setLastName("McFarway")
169
+ ),
170
+ new BatchPartialUpdateObjectNoCreateOperation<>(
171
+ "index1",
172
+ new Contact().setObjectID("myID4").setFirstName("Warren")
173
+ ),
174
+ new BatchDeleteObjectOperation(
175
+ "index2",
176
+ "myID5"
177
+ )
178
+ ));
179
+ ```
180
+
181
+ javascript: |
182
+ ```js
183
+ client.batch([
184
+ {
185
+ action: 'addObject',
186
+ indexName: 'index1',
187
+ body: {
188
+ firstname: 'Jimmie',
189
+ lastname: 'Barninger'
190
+ }
191
+ },
192
+ {
193
+ action: 'updateObject',
194
+ indexName: 'index1',
195
+ body: {
196
+ objectID: 'myID2',
197
+ firstname: 'Max',
198
+ lastname: 'Barninger'
199
+ }
200
+ },
201
+ {
202
+ action: 'partialUpdateObject',
203
+ indexName: 'index1',
204
+ body: {
205
+ objectID: 'myID3',
206
+ lastname: 'McFarway'
207
+ }
208
+ },
209
+ {
210
+ action: 'partialUpdateObjectNoCreate',
211
+ indexName: 'index1',
212
+ body: {
213
+ objectID: 'myID4',
214
+ firstname: 'Warren'
215
+ }
216
+ },
217
+ {
218
+ action: 'deleteObject',
219
+ indexName: 'index2',
220
+ body: {
221
+ objectID: 'myID5'
222
+ }
223
+ }
224
+ ], function(err, content) {
225
+ if (err) throw err;
226
+
227
+ console.log(content);
228
+ })
229
+ ```
230
+
231
+ php: |
232
+ ```php
233
+ $res = $client->multipleBatch(
234
+ [
235
+ [
236
+ 'action' => 'addObject',
237
+ 'indexName' => 'index1',
238
+ 'body' => [
239
+ 'firstname' => 'Jimmie',
240
+ 'lastname' => 'Barninger'
241
+ ]
242
+ ],
243
+ [
244
+ 'action' => 'updateObject',
245
+ 'indexName' => 'index1',
246
+ 'body' => [
247
+ 'objectID' => 'myID2',
248
+ 'firstname' => 'Max',
249
+ 'lastname' => 'Barninger'
250
+ ]
251
+ ],
252
+ [
253
+ 'action' => 'partialUpdateObject',
254
+ 'indexName' => 'index1',
255
+ 'body' => [
256
+ 'objectID' => 'myID3',
257
+ 'lastname' => 'McFarway'
258
+ ]
259
+ ],
260
+ [
261
+ 'action' => 'partialUpdateObjectNoCreate',
262
+ 'indexName' => 'index1',
263
+ 'body' => [
264
+ 'objectID' => 'myID4',
265
+ 'firstname' => 'Warren'
266
+ ]
267
+ ],
268
+ [
269
+ 'action' => 'deleteObject',
270
+ 'indexName' => 'index2',
271
+ 'body' => [
272
+ 'objectID' => 'myID5'
273
+ ]
274
+ ]
275
+ ]
276
+ );
277
+ ```
278
+
279
+ python: |
280
+ ```python
281
+ res = client.multiple_batch([
282
+ {
283
+ 'action': 'addObject',
284
+ 'indexName': 'index1',
285
+ 'body': {
286
+ 'firstname': 'Jimmie',
287
+ 'lastname': 'Barninger'
288
+ }
289
+ },
290
+ {
291
+ 'action': 'updateObject',
292
+ 'indexName': 'index1',
293
+ 'body': {
294
+ 'objectID': 'myID2',
295
+ 'firstname': 'Max',
296
+ 'lastname': 'Barninger'
297
+ }
298
+ },
299
+ {
300
+ 'action': 'partialUpdateObject',
301
+ 'indexName': 'index1',
302
+ 'body': {
303
+ 'objectID': 'myID3',
304
+ 'lastname': 'McFarway'
305
+ }
306
+ },
307
+ {
308
+ 'action': 'partialUpdateObjectNoCreate',
309
+ 'indexName': 'index1',
310
+ 'body': {
311
+ 'objectID': 'myID4',
312
+ 'firstname': 'Warren'
313
+ }
314
+ },
315
+ {
316
+ 'action': 'deleteObject',
317
+ 'indexName': 'index2',
318
+ 'body': {
319
+ 'objectID': 'myID5'
320
+ }
321
+ }
322
+ ])
323
+ ```
324
+
325
+ ruby: |
326
+ ```ruby
327
+ res = client.batch([
328
+ {
329
+ 'action': 'addObject',
330
+ 'indexName': 'index1',
331
+ 'body': {
332
+ 'firstname': 'Jimmie',
333
+ 'lastname': 'Barninger'
334
+ }
335
+ },
336
+ {
337
+ 'action': 'updateObject',
338
+ 'indexName': 'index1',
339
+ 'body': {
340
+ 'objectID': 'myID2',
341
+ 'firstname': 'Max',
342
+ 'lastname': 'Barninger'
343
+ }
344
+ }
345
+ {
346
+ 'action': 'partialUpdateObject',
347
+ 'indexName': 'index1',
348
+ 'body': {
349
+ 'objectID': 'myID3',
350
+ 'lastname': 'McFarway'
351
+ }
352
+ }
353
+ {
354
+ 'action': 'partialUpdateObjectNoCreate',
355
+ 'indexName': 'index1',
356
+ 'body': {
357
+ 'objectID': 'myID4',
358
+ 'firstname': 'Warren'
359
+ }
360
+ }
361
+ {
362
+ 'action': 'deleteObject',
363
+ 'indexName': 'index2',
364
+ 'body': {
365
+ 'objectID': 'myID5'
366
+ }
367
+ }
368
+ ])
369
+ ```
370
+
371
+ scala: |
372
+ ```scala
373
+ client.execute {
374
+ batch(
375
+ index into "index1" `object` Contact("", "Jimmie", "Barninger"),
376
+ index into "index1" `object` ContactWithObjectID("myID2", "Max", "Barninger"),
377
+ partialUpdate from "index1" `object` ContactWithObjectID("myID3", "", "McFarway"),
378
+ partialUpdate from "index1" `object` ContactWithObjectID("myID4", "Warren", "") createIfNotExists false,
379
+ delete from "index2" objectId "myID5"
380
+ )
381
+ }
382
+ ```
383
+
384
+ swift: |
385
+ ```swift
386
+ let operations: [JSONObject] = [
387
+ [
388
+ "action": "addObject",
389
+ "indexName": "index1",
390
+ "body": [
391
+ "firstname": "Jimmie",
392
+ "lastname": "Barninger"
393
+ ]
394
+ ],
395
+ [
396
+ "action": "updateObject",
397
+ "indexName": "index1",
398
+ "body": [
399
+ "objectID": "myID2",
400
+ "firstname": "Max",
401
+ "lastname": "Barninger"
402
+ ]
403
+ ],
404
+ [
405
+ "action": "partialUpdateObject",
406
+ "indexName": "index1",
407
+ "body": [
408
+ "objectID": "myID3",
409
+ "lastname": "McFarway"
410
+ ]
411
+ ],
412
+ [
413
+ "action": "partialUpdateObjectNoCreate",
414
+ "indexName": "index1",
415
+ "body": [
416
+ "objectID": "myID4",
417
+ "firstname": "Warren"
418
+ ]
419
+ ],
420
+ [
421
+ "action": "deleteObject",
422
+ "indexName": "index2",
423
+ "body": [
424
+ "objectID": "myID5"
425
+ ]
426
+ ]
427
+ ]
428
+
429
+ client.batch(operations: operations) {
430
+ (content, error) in
431
+ // Handle response
432
+ }
433
+ ```
434
+
435
+ batch_multiple_indices_with_extra_headers:
436
+ android: |
437
+ ```java
438
+ List<JSONObject> array = new ArrayList<>();
439
+
440
+ array.add(new JSONObject()
441
+ .put("action", "addObject")
442
+ .put("indexName", "index1")
443
+ .put("body", new JSONObject()
444
+ .put("firstname", "Jimmie")
445
+ .put("lastname", "Barninger")
446
+ )
447
+ );
448
+
449
+ array.add(new JSONObject()
450
+ .put("action", "addObject")
451
+ .put("indexName", "index2")
452
+ .put("body", new JSONObject()
453
+ .put("firstname", "Warren")
454
+ .put("lastname", "Speach")
455
+ )
456
+ );
457
+
458
+ client.batchAsync(
459
+ new JSONArray(array),
460
+ new RequestOptions().setHeader("X-Algolia-User-ID", "94.228.178.246"),
461
+ null
462
+ );
463
+ ```
464
+ csharp: |
465
+ ```csharp
466
+ RequestOptions requestOptions = new RequestOptions
467
+ {
468
+ Headers = new Dictionary<string,string>{ { "X-Algolia-User-ID", "user123" } }
469
+ };
470
+
471
+ List<BatchOperation<Contact>> operations = new List<BatchOperation<Contact>>
472
+ {
473
+ new BatchOperation<Contact>
474
+ {
475
+ Action = BatchActionType.AddObject,
476
+ IndexName = "index1",
477
+ Body = new Contact { FirstName = "Jimmie", LastName = "Barninger" }
478
+ },
479
+ new BatchOperation<Contact>
480
+ {
481
+ Action = BatchActionType.AddObject,
482
+ IndexName = "index1",
483
+ Body = new Contact { FirstName = "Warren", LastName = "Speach" }
484
+ }
485
+ };
486
+
487
+ client.MultipleBatch(operations, requestOptions);
488
+
489
+ // Asynchronous
490
+ client.MultipleBatchAsync(operations, requestOptions);
491
+ ```
492
+ go: |
493
+ ```go
494
+ person := algoliasearch.Map{
495
+ "firstname": "Jimmie",
496
+ "lastname": "Barninger",
497
+ }
498
+
499
+ operation := algoliasearch.BatchOperation{
500
+ Action: "addObject",
501
+ Body: person,
502
+ }
503
+
504
+ operations := []algoliasearch.BatchOperationIndexed{
505
+ {IndexName: "prodIndex", BatchOperation: operation},
506
+ {IndexName: "devIndex", BatchOperation: operation},
507
+ }
508
+
509
+ opts := &algoliasearch.RequestOptions{
510
+ ExtraHeaders: map[string]string{
511
+ "X-Algolia-User-ID": "userID2",
512
+ },
513
+ }
514
+
515
+ res, err := client.BatchWithRequestOptions(operations, opts)
516
+ ```
517
+
518
+ java: |
519
+ ```java
520
+ // Sync and Async version
521
+
522
+ client.batch(
523
+ Arrays.asList(
524
+ new BatchAddObjectOperation<>(
525
+ "index1",
526
+ new Contact().setFirstName("Jimmie").setLastName("Barninger")
527
+ ),
528
+ new BatchAddObjectOperation<>(
529
+ "index2",
530
+ new Contact().setFirstName("Warren").setLastName("Speach")
531
+ )
532
+ ),
533
+ new RequestOptions().addExtraHeader("X-Algolia-User-ID", "user123")
534
+ );
535
+ ```
536
+
537
+ javascript: |
538
+ ```js
539
+ client.setExtraHeader('X-FORWARDED-FOR', '94.228.178.246');
540
+ client.batch([
541
+ {
542
+ action: 'addObject',
543
+ indexName: 'index1',
544
+ body:
545
+ {
546
+ firstname: 'Jimmie',
547
+ lastname: 'Barninger'
548
+ }
549
+ },
550
+ {
551
+ action: 'addObject',
552
+ indexName: 'index2',
553
+ body: {
554
+ firstname: 'Warren',
555
+ lastname: 'Speach'
556
+ }
557
+ }
558
+ ], function(err, content) {
559
+ if (err) throw err;
560
+
561
+ console.log(content);
562
+ })
563
+ ```
564
+ php: |
565
+ ```php
566
+ $operations = [
567
+ [
568
+ 'action' => 'addObject',
569
+ 'indexName' => 'index1',
570
+ 'body' => [
571
+ 'firstname' => 'Jimmie',
572
+ 'lastname' => 'Barninger'
573
+ ]
574
+ ],
575
+ [
576
+ 'action' => 'addObject',
577
+ 'indexName' => 'index2',
578
+ 'body' => [
579
+ 'firstname' => 'Warren',
580
+ 'lastname' => 'Speach'
581
+ ]
582
+ ]
583
+ ];
584
+
585
+ $res = $client->multipleBatch($operations, [
586
+ 'X-FORWARDED-FOR' => '94.228.178.246'
587
+ ]);
588
+ ```
589
+ python: |
590
+ ```python
591
+ res = client.multiple_batch(
592
+ [
593
+ {
594
+ 'action': 'addObject',
595
+ 'indexName': 'index1',
596
+ 'body': {'firstname': 'Jimmie', 'lastname': 'Barninger'}
597
+ },
598
+ {
599
+ 'action': 'addObject',
600
+ 'indexName': 'index2',
601
+ 'body': {'firstname': 'Warren', 'lastname': 'Speach'}
602
+ }
603
+ ],
604
+ {
605
+ 'X-FORWARDED-FOR': '94.228.178.246'
606
+ }
607
+ )
608
+ ```
609
+ ruby: |
610
+ ```ruby
611
+ operations = [
612
+ {
613
+ 'action': 'addObject',
614
+ 'indexName': 'index1',
615
+ 'body': {'firstname': 'Jimmie', 'lastname': 'Barninger'}
616
+ },
617
+ {
618
+ 'action': 'addObject',
619
+ 'indexName': 'index2',
620
+ 'body': {'firstname': 'Warren', 'lastname': 'Speach'}
621
+ }
622
+ ]
623
+
624
+ extra_headers = {
625
+ 'X-FORWARDED-FOR': '94.228.178.246'
626
+ }
627
+
628
+ res = client.batch(operations, extra_headers)
629
+ ```
630
+ scala: |
631
+ ```scala
632
+ client.execute {
633
+ batch(
634
+ index into "index1" `object` Contact("Jimmie", "Barninger"),
635
+ index into "index2" `object` Contact("Warren", "Speach")
636
+ ) options RequestOptions(extraHeaders = Some(
637
+ Map("X-Algolia-User-ID" => "user123"))
638
+ )
639
+ }
640
+ ```
641
+
642
+ swift: |
643
+ ```swift
644
+ let operations: [JSONObject] = [
645
+ [
646
+ "action": "addObject",
647
+ "indexName": "index1",
648
+ "body": [
649
+ "firstname": "Jimmie",
650
+ "lastname": "Barninger"
651
+ ]
652
+ ],
653
+ [
654
+ "action": "addObject",
655
+ "indexName": "index2",
656
+ "body": [
657
+ "firstname": "Warren",
658
+ "lastname": "Speach"
659
+ ]
660
+ ]
661
+ ]
662
+
663
+ let requestOptions = RequestOptions()
664
+ requestOptions.headers["X-Algolia-User-ID"] = "user123"
665
+
666
+ client.batch(operations: operations, requestOptions: requestOptions) {
667
+ (content, error) in
668
+ // Handle response
669
+ }
670
+ ```