Skip to content

Commit 7c33b47

Browse files
authored
Merge pull request #1551 from algolia/epic/MAGE-721
Epic/mage 721 - sync replica work with release
2 parents 7a06152 + 1743f99 commit 7c33b47

Some content is hidden

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

47 files changed

+1931
-1366
lines changed

Api/Insights/EventsInterface.php renamed to Api/Insights/EventProcessorInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Sales\Model\Order;
1010
use Magento\Store\Model\StoreManagerInterface;
1111

12-
interface EventsInterface
12+
interface EventProcessorInterface
1313
{
1414
/** @var string */
1515
public const EVENT_KEY_SUBTYPE = 'eventSubtype';
@@ -37,13 +37,13 @@ interface EventsInterface
3737
/** @var int */
3838
public const MAX_EVENTS_PER_REQUEST = 1000;
3939

40-
public function setInsightsClient(InsightsClient $client): EventsInterface;
40+
public function setInsightsClient(InsightsClient $client): EventProcessorInterface;
4141

42-
public function setAuthenticatedUserToken(string $token): EventsInterface;
42+
public function setAuthenticatedUserToken(string $token): EventProcessorInterface;
4343

44-
public function setAnonymousUserToken(string $token): EventsInterface;
44+
public function setAnonymousUserToken(string $token): EventProcessorInterface;
4545

46-
public function setStoreManager(StoreManagerInterface $storeManager): EventsInterface;
46+
public function setStoreManager(StoreManagerInterface $storeManager): EventProcessorInterface;
4747

4848
/**
4949
* @param string $eventName
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Product;
4+
5+
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException;
6+
use Algolia\AlgoliaSearch\Exceptions\ExceededRetriesException;
7+
use Magento\Framework\Exception\LocalizedException;
8+
use Magento\Framework\Exception\NoSuchEntityException;
9+
10+
interface ReplicaManagerInterface
11+
{
12+
public const SORT_ATTRIBUTE_PRICE = 'price';
13+
14+
public const SORT_KEY_ATTRIBUTE_NAME = 'attribute';
15+
public const SORT_KEY_VIRTUAL_REPLICA = 'virtualReplica';
16+
public const MAX_VIRTUAL_REPLICA_LIMIT = 20;
17+
18+
/**
19+
* Configure replicas in Algolia based on the sorting configuration in Magento
20+
*
21+
* @param int $storeId
22+
* @param array<string, mixed> $primaryIndexSettings
23+
* @return void
24+
*
25+
* @throws AlgoliaException
26+
* @throws ExceededRetriesException
27+
* @throws LocalizedException
28+
* @throws NoSuchEntityException
29+
*/
30+
public function syncReplicasToAlgolia(int $storeId, array $primaryIndexSettings): void;
31+
32+
/**
33+
* For standard Magento front end (e.g. Luma) replicas will likely only be needed if InstantSearch is enabled
34+
* Headless implementations may wish to override this behavior via plugin
35+
* @param int $storeId
36+
* @return bool
37+
*/
38+
public function isReplicaSyncEnabled(int $storeId): bool;
39+
40+
/**
41+
* Return the number of virtual replicas permitted per index
42+
* @link https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#differences
43+
*
44+
* @return int
45+
*/
46+
public function getMaxVirtualReplicasPerIndex() : int;
47+
}

0 commit comments

Comments
 (0)