Skip to content

Commit 3ecbf4e

Browse files
authored
Merge pull request #1730 from algolia/release/3.15.0
3.15.0 to main
2 parents 505d2e2 + eb3515e commit 3ecbf4e

File tree

152 files changed

+10189
-6733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+10189
-6733
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Builder;
4+
5+
use Algolia\AlgoliaSearch\Api\Data\IndexOptionsInterface;
6+
7+
interface EntityIndexOptionsBuilderInterface
8+
{
9+
public function buildEntityIndexOptions(int $storeId, ?bool $isTmp = false): IndexOptionsInterface;
10+
}

Api/Builder/IndexBuilderInterface.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Builder;
4+
5+
interface IndexBuilderInterface
6+
{
7+
public function buildIndex(int $storeId, ?array $entityIds, ?array $options): void;
8+
9+
public function buildIndexFull(int $storeId, ?array $options): void;
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Builder;
4+
5+
use Magento\Framework\DataObject;
6+
7+
interface RecordBuilderInterface
8+
{
9+
public function buildRecord(DataObject $entity): array;
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Builder;
4+
5+
interface UpdatableIndexBuilderInterface extends IndexBuilderInterface
6+
{
7+
public function buildIndexList(int $storeId, ?array $entityIds, ?array $options): void;
8+
}

Api/Data/IndexOptionsInterface.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Data;
4+
5+
interface IndexOptionsInterface
6+
{
7+
const STORE_ID = 'store_id';
8+
9+
const INDEX_SUFFIX = 'index_suffix';
10+
11+
const IS_TMP = 'is_tmp';
12+
13+
const INDEX_NAME = 'index_name';
14+
15+
/**
16+
* Get field: store_id
17+
*
18+
* @return int|null
19+
*/
20+
public function getStoreId(): ?int;
21+
22+
/**
23+
* Get field: index_suffix
24+
*
25+
* @return string|null
26+
*/
27+
public function getIndexSuffix(): ?string;
28+
29+
/**
30+
* Get field: is_tmp
31+
*
32+
* @return bool
33+
*/
34+
public function isTemporaryIndex(): bool;
35+
36+
/**
37+
* Get field: index_name
38+
*
39+
* @return string|null
40+
*/
41+
public function getIndexName(): ?string;
42+
43+
/**
44+
* Set field: index_name
45+
*
46+
* @param string $indexName
47+
* @return void
48+
*/
49+
public function setIndexName(string $indexName): void;
50+
}

Block/Adminhtml/LandingPage/SearchConfiguration.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ class SearchConfiguration extends \Magento\Backend\Block\Template
2222
/** @var Data */
2323
private $coreHelper;
2424

25-
/** @var int */
26-
protected $planLevel;
27-
2825
/**
2926
* @param Context $context
3027
* @param SessionManagerInterface $backendSession

Block/Configuration.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Configuration extends Algolia implements CollectionDataSourceInterface
1313
//Placeholder for future implementation (requires custom renderer for hierarchicalMenu widget)
1414
private const IS_CATEGORY_NAVIGATION_ENABLED = false;
1515

16-
public function isSearchPage()
16+
public function isSearchPage(): bool
1717
{
1818
if ($this->getConfigHelper()->isInstantEnabled()) {
1919
/** @var Http $request */
@@ -80,8 +80,6 @@ public function getConfiguration()
8080

8181
$suggestionHelper = $this->getSuggestionHelper();
8282

83-
$productHelper = $this->getProductHelper();
84-
8583
$algoliaHelper = $this->getAlgoliaHelper();
8684

8785
$persoHelper = $this->getPersonalizationHelper();
@@ -249,12 +247,13 @@ public function getConfiguration()
249247
'indexName' => $coreHelper->getBaseIndexName(),
250248
'apiKey' => $algoliaHelper->generateSearchSecuredApiKey(
251249
$config->getSearchOnlyAPIKey(),
252-
$attributesToFilter
250+
$attributesToFilter,
251+
$this->getStoreId()
253252
),
254253
'attributeFilter' => $attributesToFilter,
255254
'facets' => $facets,
256255
'areCategoriesInFacets' => $areCategoriesInFacets,
257-
'hitsPerPage' => (int) $config->getNumberOfProductResults(),
256+
'hitsPerPage' => $config->getNumberOfProductResults(),
258257
'sortingIndices' => array_values($this->sortingTransformer->getSortingIndices(
259258
$this->getStoreId(),
260259
$customerGroupId
@@ -421,7 +420,7 @@ protected function getOrderedProductIds(ConfigHelper $configHelper, Http $reques
421420
return $ids;
422421
}
423422

424-
protected function isLandingPage()
423+
protected function isLandingPage(): bool
425424
{
426425
return $this->getRequest()->getFullActionName() === 'algolia_landingpage_view';
427426
}
@@ -440,4 +439,15 @@ protected function getLandingPageConfiguration()
440439
{
441440
return $this->isLandingPage() ? $this->getCurrentLandingPage()->getConfiguration() : json_encode([]);
442441
}
442+
443+
public function canLoadInstantSearch(): bool
444+
{
445+
return $this->getConfigHelper()->isInstantEnabled()
446+
&& $this->isProductListingPage();
447+
}
448+
449+
protected function isProductListingPage(): bool
450+
{
451+
return $this->isSearchPage() || $this->isLandingPage();
452+
}
443453
}

CHANGELOG.md

Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
# CHANGE LOG
22

3+
## 3.15.0
4+
5+
### Features
6+
- Added support for Multi-Application IDs (see [documentation](https://www.algolia.com/doc/integration/magento-2/getting-started/quick-start/#support-for-multiple-application-ids))
7+
- Refactored frontend library to no longer utilize the legacy `algoliaBundle` (see [documentation](https://www.algolia.com/doc/integration/magento-2/customize/custom-front-end-events/?client=php#frontend-javascript-libraries-and-the-legacy-bundle))
8+
- Added support for core Algolia UI library overrides via RequireJS
9+
- Added support for mixins through RequireJS in addition to [front end custom events](https://www.algolia.com/doc/integration/magento-2/customize/custom-front-end-events)
10+
- See our `CustomAlgolia` demo extension's [1.4.0 release](https://github.com/algolia/algoliasearch-custom-algolia-magento-2/releases/tag/1.4.0) for examples on how to take advantage of these changes
11+
- Added granular profiling through the [Magento Profiler](https://experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/setup/mage-profiler) to aid in troubleshooting indexing performance issues
12+
- Added a feature to enable automatic price indexing within the Advanced section of the configuration (This feature should help alleviate issues where missing pricing records prevent Algolia from being able to index products. See [documentation](https://www.algolia.com/doc/integration/magento-2/troubleshooting/data-indexes-queues/#price-index-dependencies) for further details.)
13+
- Reorganization of the test folders
14+
- Added unit and integration tests for full page cache (FPC)
15+
16+
### Updates
17+
- Tests: Added possibility to run tests with multiple applications IDs.
18+
- Introduced Index Builders which are services responsible for creating and filling indices with data.
19+
- **IMPORTANT**: As a result `AlgoliaHelper` is now deprecated and will be removed from the codebase in version 3.16.0
20+
- Added `BackendSearch` Service to move `getSearchResults` method into.
21+
- Updated Indexing Queue display in the admin by adding the `class` column
22+
- Updated Indexing Queue `data` column formatting
23+
- Added documentation link on the queue archive page
24+
- Debugging information now writes to `algolia.log`
25+
- Removed dependency on `algoliaBundle` package
26+
- Removed dependency on JavaScript global `window` objects with the exception of `algoliaConfig`
27+
- The Hogan.js library is still packaged for injection as needed but be advised that Mustache.js is now used internally instead (see [documentation](https://www.algolia.com/doc/integration/magento-2/customize/instant-search-page/?client=php#mustache-templates))
28+
- JavaScript bundling is supported but to use the RequireJS Optimizer transpiling will be needed for ES6 constructs
29+
30+
### Bug Fixes
31+
- Fixed a bug where admin menus didn't display properly on Magento 2.4.7
32+
- Fixed customer groups prices ranges on configurable products
33+
- Fixed a bug where categories highlighting didn't work as expected on PLP powered by InstantSearch
34+
- Fixed a bug where excluded websites weren't taken into account while indexing customer prices on products. (thanks @kamilszewczyk)
35+
- Fixed a bug where full page cache (FPC) didn't work on category pages
36+
37+
### Breaking Changes
38+
- If you have customized your front end implementation based on the `algoliaBundle` you may need to shim your application accordingly (Full details are shared in [our documentation](https://www.algolia.com/doc/integration/magento-2/troubleshooting/front-end-issues/))
39+
40+
341
## 3.14.4
442

543
### Features
@@ -93,24 +131,29 @@ If you have customized your Algolia implementation or are running on an older ve
93131
- Dropped support for Magento 2.3
94132
- PHP 8.1+ required
95133

96-
## 3.14.0-beta.2
134+
## 3.13.8
135+
136+
### Bug Fixes
137+
- Restored compatibility with PHP 7.4
138+
139+
## 3.13.7
140+
141+
### Features
142+
- Added a feature to enable automatic price indexing on the Advanced section of the configuration (This feature should help alleviate issues where missing pricing records prevent Algolia from being able to index products.)
97143

98144
### Updates
145+
- Updated `getCookie` method to make it more consistent
146+
- Removed dependency to `catalog_product_price` indexer
99147

100-
- Introduced new admin groups to InstantSearch for improved UX
101-
- Updated `ConfigHelper` to use new paths
102-
- Added data patch to migrate old configurations
103-
- Bugfix for query rule disable on facets with new admin groupings
104-
- Added new sorting admin option via source model
105-
- Added derived virtual replica enablement to `ConfigHelper` based on `ArraySerialized`
106-
- Intro’d simplified data structures to avoid array diff mismatches
107-
- Intro’d new `ReplicaManager` abstraction to map Magento sorting to Algolia replica configuration
108-
- Removed dependencies in backend models to handle replica config updates in Algolia addressing stale data
109-
- Added `ReplicaState` registry for tracking changes to sorting configuration to minimize number of replica build operations
110-
- Added logic to preserve replicas created outside of Magento such as Merchandising Studio "sorting strategies"
111-
- Introduced PHP 8 constructor property promotion on affected classes
112-
- Added stronger typing to affected classes and methods
113-
- Added Looking Similar recommendations
148+
### Bug Fixes
149+
- Fixed a bug where the Landing Page Builder was crashing on save with customer group pricing was enabled.
150+
- Fixed issue where Insights information wasn't kept on the url after clicking "add to cart" on PLP powered by InstantSearch
151+
152+
## 3.13.6
153+
154+
### Bug Fixes
155+
- Improve handling of insights params for URLs that already have a query string
156+
- Improve query method for alternate root categories - Thank you @igorfigueiredogen
114157

115158
## 3.13.5
116159

@@ -129,20 +172,6 @@ If you have customized your Algolia implementation or are running on an older ve
129172
- Fixed lock timeout issue on indexing queue integration test
130173
- Community fix added - job queue dropping jobs from sandwiched full reindexes - thank you @pikulsky
131174

132-
## 3.14.0-beta.1
133-
134-
### Updates:
135-
136-
- New PHP API client (v4) under the hood for communicating with Algolia
137-
- Authenticated user tokens now utilized for backend and frontend events to track entire customer journey
138-
- Revenue data now sent with all events including application of Magento specific discounts such as catalog price rules and customer group pricing
139-
- Support for event subtypes allowing the capture of conversion data for both "Add to cart" and "Place order" events
140-
- Increased protection of PII in the event data
141-
142-
### Bug fixes:
143-
- Fixed issue with how Algolia extension handles end user consent for allowing cookies
144-
- Improved handling of user tokens across insights events and corresponding queries
145-
146175
## 3.13.3
147176

148177
### Updates

Console/Command/AbstractReplicaCommand.php

Lines changed: 3 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -2,123 +2,11 @@
22

33
namespace Algolia\AlgoliaSearch\Console\Command;
44

5-
use Algolia\AlgoliaSearch\Service\StoreNameFetcher;
6-
use Magento\Framework\App\Area;
7-
use Magento\Framework\App\State;
8-
use Magento\Framework\Exception\LocalizedException;
9-
use Symfony\Component\Console\Command\Command;
10-
use Symfony\Component\Console\Input\InputArgument;
11-
use Symfony\Component\Console\Input\InputInterface;
12-
use Symfony\Component\Console\Output\OutputInterface;
13-
use Symfony\Component\Console\Question\ConfirmationQuestion;
14-
15-
abstract class AbstractReplicaCommand extends Command
5+
abstract class AbstractReplicaCommand extends AbstractStoreCommand
166
{
17-
protected const STORE_ARGUMENT = 'store';
18-
19-
protected ?OutputInterface $output = null;
20-
protected ?InputInterface $input = null;
21-
22-
public function __construct(
23-
protected State $state,
24-
protected StoreNameFetcher $storeNameFetcher,
25-
?string $name = null
26-
)
27-
{
28-
parent::__construct($name);
29-
}
30-
31-
abstract protected function getReplicaCommandName(): string;
32-
33-
abstract protected function getCommandDescription(): string;
34-
35-
abstract protected function getStoreArgumentDescription(): string;
36-
37-
abstract protected function getAdditionalDefinition(): array;
38-
39-
/**
40-
* @inheritDoc
41-
*/
42-
protected function configure(): void
43-
{
44-
$definition = [$this->getStoreArgumentDefinition()];
45-
$definition = array_merge($definition, $this->getAdditionalDefinition());
46-
47-
$this->setName($this->getCommandName())
48-
->setDescription($this->getCommandDescription())
49-
->setDefinition($definition);
50-
51-
parent::configure();
52-
}
53-
54-
protected function getStoreArgumentDefinition(): InputArgument {
55-
return new InputArgument(
56-
self::STORE_ARGUMENT,
57-
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
58-
$this->getStoreArgumentDescription()
59-
);
60-
}
61-
62-
public function getCommandName(): string
63-
{
64-
return 'algolia:replicas:' . $this->getReplicaCommandName();
65-
}
66-
67-
protected function setAreaCode(): void
68-
{
69-
try {
70-
$this->state->setAreaCode(Area::AREA_CRONTAB);
71-
} catch (LocalizedException) {
72-
// Area code is already set - nothing to do
73-
}
74-
}
75-
76-
/**
77-
* @param InputInterface $input
78-
* @return int[]
79-
*/
80-
protected function getStoreIds(InputInterface $input): array
81-
{
82-
return (array) $input->getArgument(self::STORE_ARGUMENT);
83-
}
84-
85-
/**
86-
* @param int[] $storeIds
87-
* @return string
88-
*/
89-
protected function getOperationTargetLabel(array $storeIds): string
90-
{
91-
return ($storeIds ? count($storeIds) : 'all') . ' store' . (!$storeIds || count($storeIds) > 1 ? 's' : '');
92-
}
93-
94-
/**
95-
* Generate a CLI operation announcement based on passed store arguments
96-
* @param string $msg Use {{target} in message as a placeholder for inserting the generated target label
97-
* @param int[] $storeIds
98-
* @return string
99-
*/
100-
protected function decorateOperationAnnouncementMessage(string $msg, array $storeIds): string
7+
protected function getCommandPrefix(): string
1018
{
102-
$msg = str_replace('{{target}}', $this->getOperationTargetLabel($storeIds), $msg);
103-
return ($storeIds)
104-
? "<info>$msg: " . join(", ", $this->storeNameFetcher->getStoreNames($storeIds)) . '</info>'
105-
: "<info>$msg</info>";
9+
return parent::getCommandPrefix() . 'replicas:';
10610
}
10711

108-
protected function confirmOperation(string $okMessage = '', string $cancelMessage = 'Operation cancelled'): bool
109-
{
110-
$helper = $this->getHelper('question');
111-
$question = new ConfirmationQuestion('<question>Are you sure wish to proceed? (y/n)</question> ', false);
112-
if (!$helper->ask($this->input, $this->output, $question)) {
113-
if ($cancelMessage) {
114-
$this->output->writeln("<comment>$cancelMessage</comment>");
115-
}
116-
return false;
117-
}
118-
119-
if ($okMessage) {
120-
$this->output->writeln("<comment>$okMessage</comment>");
121-
}
122-
return true;
123-
}
12412
}

0 commit comments

Comments
 (0)