Version Notes
- FIX: Improve performance issue when backend-search
- FIX: Various small improvements
Download this release
Release Info
Developer | Algolia Team |
Extension | algoliasearch |
Version | 1.4.5 |
Comparing to | |
See all releases |
Code changes from version 1.4.4 to 1.4.5
- app/code/community/Algolia/Algoliasearch/Helper/Data.php +39 -8
- app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php +45 -15
- app/code/community/Algolia/Algoliasearch/Model/Indexer/Algolia.php +7 -1
- app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext.php +8 -0
- app/code/community/Algolia/Algoliasearch/etc/system.xml +1 -1
- app/design/frontend/base/default/template/algoliasearch/topsearch.phtml +1 -1
- package.xml +6 -6
- skin/frontend/base/default/algoliasearch/algoliasearch.css +7 -0
app/code/community/Algolia/Algoliasearch/Helper/Data.php
CHANGED
@@ -23,7 +23,7 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
23 |
|
24 |
public function __construct()
|
25 |
{
|
26 |
-
\AlgoliaSearch\Version::$custom_value = " Magento (1.4.
|
27 |
|
28 |
$this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
|
29 |
|
@@ -46,6 +46,9 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
46 |
{
|
47 |
$this->algolia_helper->resetCredentialsFromConfig();
|
48 |
|
|
|
|
|
|
|
49 |
$this->algolia_helper->setSettings($this->category_helper->getIndexName($storeId), $this->category_helper->getIndexSettings($storeId));
|
50 |
$this->algolia_helper->setSettings($this->page_helper->getIndexName($storeId), $this->page_helper->getIndexSettings($storeId));
|
51 |
$this->algolia_helper->setSettings($this->suggestion_helper->getIndexName($storeId), $this->suggestion_helper->getIndexSettings($storeId));
|
@@ -62,8 +65,13 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
62 |
|
63 |
$index_name = $this->product_helper->getIndexName($storeId);
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
$answer = $this->algolia_helper->query($index_name, $query, array(
|
66 |
-
'hitsPerPage' =>
|
67 |
'attributesToRetrieve' => 'objectID',
|
68 |
'attributesToHighlight' => '',
|
69 |
'attributesToSnippet' => '',
|
@@ -174,7 +182,7 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
174 |
|
175 |
while ($page <= $pages)
|
176 |
{
|
177 |
-
$this->rebuildStoreCategoryIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage());
|
178 |
|
179 |
$page++;
|
180 |
}
|
@@ -237,7 +245,7 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
237 |
|
238 |
while ($page <= $pages)
|
239 |
{
|
240 |
-
$this->rebuildStoreProductIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage());
|
241 |
|
242 |
$page++;
|
243 |
}
|
@@ -284,8 +292,13 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
284 |
unset($collection);
|
285 |
}
|
286 |
|
287 |
-
public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $page, $pageSize)
|
288 |
{
|
|
|
|
|
|
|
|
|
|
|
289 |
$collection = clone $collectionDefault;
|
290 |
$collection->setCurPage($page)->setPageSize($pageSize);
|
291 |
$collection->load();
|
@@ -317,6 +330,9 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
317 |
$collection->clear();
|
318 |
|
319 |
unset($collection);
|
|
|
|
|
|
|
320 |
}
|
321 |
|
322 |
private function getProductsRecords($storeId, $collection)
|
@@ -336,8 +352,13 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
336 |
return $indexData;
|
337 |
}
|
338 |
|
339 |
-
public function rebuildStoreProductIndexPage($storeId, $collectionDefault, $page, $pageSize)
|
340 |
{
|
|
|
|
|
|
|
|
|
|
|
341 |
$collection = clone $collectionDefault;
|
342 |
$collection->setCurPage($page)->setPageSize($pageSize);
|
343 |
$collection->load();
|
@@ -346,7 +367,6 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
346 |
|
347 |
$index_name = $this->product_helper->getIndexName($storeId);
|
348 |
|
349 |
-
|
350 |
/**
|
351 |
* Normal Indexing
|
352 |
*/
|
@@ -361,11 +381,17 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
361 |
$collection->clear();
|
362 |
|
363 |
unset($collection);
|
|
|
|
|
|
|
364 |
}
|
365 |
|
366 |
public function startEmulation($storeId)
|
367 |
{
|
368 |
-
$
|
|
|
|
|
|
|
369 |
$info->setInitialStoreId(Mage::app()->getStore()->getId());
|
370 |
$info->setEmulatedStoreId($storeId);
|
371 |
$info->setUseProductFlat(Mage::getStoreConfigFlag(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, $storeId));
|
@@ -373,13 +399,18 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
373 |
Mage::app()->setCurrentStore($storeId);
|
374 |
Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, FALSE);
|
375 |
Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, FALSE);
|
|
|
376 |
return $info;
|
377 |
}
|
378 |
|
379 |
public function stopEmulation($info)
|
380 |
{
|
|
|
|
|
381 |
Mage::app()->setCurrentStore($info->getInitialStoreId());
|
382 |
Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, $info->getUseProductFlat());
|
383 |
Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, $info->getUseCategoryFlat());
|
|
|
|
|
384 |
}
|
385 |
}
|
23 |
|
24 |
public function __construct()
|
25 |
{
|
26 |
+
\AlgoliaSearch\Version::$custom_value = " Magento (1.4.5)";
|
27 |
|
28 |
$this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
|
29 |
|
46 |
{
|
47 |
$this->algolia_helper->resetCredentialsFromConfig();
|
48 |
|
49 |
+
if (! ($this->config->getApplicationID() && $this->config->getAPIKey()))
|
50 |
+
return;
|
51 |
+
|
52 |
$this->algolia_helper->setSettings($this->category_helper->getIndexName($storeId), $this->category_helper->getIndexSettings($storeId));
|
53 |
$this->algolia_helper->setSettings($this->page_helper->getIndexName($storeId), $this->page_helper->getIndexSettings($storeId));
|
54 |
$this->algolia_helper->setSettings($this->suggestion_helper->getIndexName($storeId), $this->suggestion_helper->getIndexSettings($storeId));
|
65 |
|
66 |
$index_name = $this->product_helper->getIndexName($storeId);
|
67 |
|
68 |
+
$number_of_results = 1000;
|
69 |
+
|
70 |
+
if ($this->config->isInstantEnabled())
|
71 |
+
$number_of_results = min($this->config->getNumberOfProductResults($storeId), 1000);
|
72 |
+
|
73 |
$answer = $this->algolia_helper->query($index_name, $query, array(
|
74 |
+
'hitsPerPage' => $number_of_results, // retrieve all the hits (hard limit is 1000)
|
75 |
'attributesToRetrieve' => 'objectID',
|
76 |
'attributesToHighlight' => '',
|
77 |
'attributesToSnippet' => '',
|
182 |
|
183 |
while ($page <= $pages)
|
184 |
{
|
185 |
+
$this->rebuildStoreCategoryIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage(), $emulationInfo);
|
186 |
|
187 |
$page++;
|
188 |
}
|
245 |
|
246 |
while ($page <= $pages)
|
247 |
{
|
248 |
+
$this->rebuildStoreProductIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage(), $emulationInfo);
|
249 |
|
250 |
$page++;
|
251 |
}
|
292 |
unset($collection);
|
293 |
}
|
294 |
|
295 |
+
public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
|
296 |
{
|
297 |
+
$emulationInfoPage = null;
|
298 |
+
|
299 |
+
if ($emulationInfo === null)
|
300 |
+
$emulationInfoPage = $this->startEmulation($storeId);
|
301 |
+
|
302 |
$collection = clone $collectionDefault;
|
303 |
$collection->setCurPage($page)->setPageSize($pageSize);
|
304 |
$collection->load();
|
330 |
$collection->clear();
|
331 |
|
332 |
unset($collection);
|
333 |
+
|
334 |
+
if ($emulationInfo === null)
|
335 |
+
$this->stopEmulation($emulationInfoPage);
|
336 |
}
|
337 |
|
338 |
private function getProductsRecords($storeId, $collection)
|
352 |
return $indexData;
|
353 |
}
|
354 |
|
355 |
+
public function rebuildStoreProductIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
|
356 |
{
|
357 |
+
$emulationInfoPage = null;
|
358 |
+
|
359 |
+
if ($emulationInfo === null)
|
360 |
+
$emulationInfoPage = $this->startEmulation($storeId);
|
361 |
+
|
362 |
$collection = clone $collectionDefault;
|
363 |
$collection->setCurPage($page)->setPageSize($pageSize);
|
364 |
$collection->load();
|
367 |
|
368 |
$index_name = $this->product_helper->getIndexName($storeId);
|
369 |
|
|
|
370 |
/**
|
371 |
* Normal Indexing
|
372 |
*/
|
381 |
$collection->clear();
|
382 |
|
383 |
unset($collection);
|
384 |
+
|
385 |
+
if ($emulationInfo === null)
|
386 |
+
$this->stopEmulation($emulationInfoPage);
|
387 |
}
|
388 |
|
389 |
public function startEmulation($storeId)
|
390 |
{
|
391 |
+
$appEmulation = Mage::getSingleton('core/app_emulation');
|
392 |
+
|
393 |
+
$info = $appEmulation->startEnvironmentEmulation($storeId);
|
394 |
+
|
395 |
$info->setInitialStoreId(Mage::app()->getStore()->getId());
|
396 |
$info->setEmulatedStoreId($storeId);
|
397 |
$info->setUseProductFlat(Mage::getStoreConfigFlag(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, $storeId));
|
399 |
Mage::app()->setCurrentStore($storeId);
|
400 |
Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, FALSE);
|
401 |
Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, FALSE);
|
402 |
+
|
403 |
return $info;
|
404 |
}
|
405 |
|
406 |
public function stopEmulation($info)
|
407 |
{
|
408 |
+
$appEmulation = Mage::getSingleton('core/app_emulation');
|
409 |
+
|
410 |
Mage::app()->setCurrentStore($info->getInitialStoreId());
|
411 |
Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, $info->getUseProductFlat());
|
412 |
Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, $info->getUseCategoryFlat());
|
413 |
+
|
414 |
+
$appEmulation->stopEnvironmentEmulation($info);
|
415 |
}
|
416 |
}
|
app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php
CHANGED
@@ -185,7 +185,8 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
185 |
|
186 |
$suffix_index_name = '_group_' . $group_id;
|
187 |
|
188 |
-
$
|
|
|
189 |
|
190 |
$this->algolia_helper->setSettings($this->getIndexName($storeId).$suffix_index_name.'_'.$values['attribute'].'_'.$values['sort'], $mergeSettings);
|
191 |
}
|
@@ -193,7 +194,9 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
193 |
}
|
194 |
else
|
195 |
{
|
196 |
-
$
|
|
|
|
|
197 |
|
198 |
$this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . 'default' . '_' .$values['attribute'].'_'.$values['sort'], $mergeSettings);
|
199 |
}
|
@@ -263,10 +266,15 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
263 |
$customData = array(
|
264 |
'objectID' => $product->getId(),
|
265 |
'name' => $product->getName(),
|
266 |
-
'url' => $product->getProductUrl()
|
267 |
-
'description' => $product->getDescription()
|
268 |
);
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
foreach (array('price', 'price_with_tax', 'special_price_from_date', 'special_price_to_date', 'special_price'
|
271 |
,'special_price_with_tax', 'special_price_formated', 'special_price_with_tax_formated'
|
272 |
,'price_formated', 'price_with_tax_formated') as $price)
|
@@ -364,9 +372,14 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
364 |
$customData['image_url'] = str_replace(array('https://', 'http://'), '//', $customData['image_url']);
|
365 |
}
|
366 |
catch (\Exception $e) {}
|
367 |
-
}
|
368 |
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
$sub_products = null;
|
372 |
$ids = null;
|
@@ -409,7 +422,12 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
409 |
}, $sub_products);
|
410 |
}
|
411 |
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
if ($product->getTypeId() == 'grouped' || $product->getTypeId() == 'configurable')
|
415 |
{
|
@@ -505,14 +523,17 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
505 |
}
|
506 |
|
507 |
|
508 |
-
if (
|
509 |
{
|
510 |
-
$
|
511 |
-
|
512 |
-
|
|
|
|
|
513 |
|
514 |
-
|
515 |
-
|
|
|
516 |
}
|
517 |
|
518 |
foreach ($additionalAttributes as $attribute)
|
@@ -537,6 +558,11 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
537 |
|
538 |
foreach ($sub_products as $sub_product)
|
539 |
{
|
|
|
|
|
|
|
|
|
|
|
540 |
$value = $sub_product->getData($attribute['attribute']);
|
541 |
|
542 |
if ($value)
|
@@ -552,7 +578,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
552 |
|
553 |
if (count($values) > 0)
|
554 |
{
|
555 |
-
$customData[$attribute['attribute']] = $values;
|
556 |
}
|
557 |
}
|
558 |
}
|
@@ -576,6 +602,10 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
576 |
}
|
577 |
}
|
578 |
|
|
|
|
|
|
|
|
|
579 |
$customData = array_merge($customData, $defaultData);
|
580 |
|
581 |
$customData['type_id'] = $product->getTypeId();
|
@@ -584,4 +614,4 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
584 |
|
585 |
return $customData;
|
586 |
}
|
587 |
-
}
|
185 |
|
186 |
$suffix_index_name = '_group_' . $group_id;
|
187 |
|
188 |
+
$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'].'.'.$group_id : $values['attribute'];
|
189 |
+
$mergeSettings['ranking'] = array($values['sort'].'('.$sort_attribute.')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');
|
190 |
|
191 |
$this->algolia_helper->setSettings($this->getIndexName($storeId).$suffix_index_name.'_'.$values['attribute'].'_'.$values['sort'], $mergeSettings);
|
192 |
}
|
194 |
}
|
195 |
else
|
196 |
{
|
197 |
+
$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'].'.'.'default' : $values['attribute'];
|
198 |
+
|
199 |
+
$mergeSettings['ranking'] = array($values['sort'].'('.$sort_attribute.')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');
|
200 |
|
201 |
$this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . 'default' . '_' .$values['attribute'].'_'.$values['sort'], $mergeSettings);
|
202 |
}
|
266 |
$customData = array(
|
267 |
'objectID' => $product->getId(),
|
268 |
'name' => $product->getName(),
|
269 |
+
'url' => $product->getProductUrl()
|
|
|
270 |
);
|
271 |
|
272 |
+
$additionalAttributes = $this->config->getProductAdditionalAttributes($product->getStoreId());
|
273 |
+
|
274 |
+
if ($this->isAttributeEnabled($additionalAttributes, 'description'))
|
275 |
+
$customData['description'] = $product->getDescription();
|
276 |
+
|
277 |
+
|
278 |
foreach (array('price', 'price_with_tax', 'special_price_from_date', 'special_price_to_date', 'special_price'
|
279 |
,'special_price_with_tax', 'special_price_formated', 'special_price_with_tax_formated'
|
280 |
,'price_formated', 'price_with_tax_formated') as $price)
|
372 |
$customData['image_url'] = str_replace(array('https://', 'http://'), '//', $customData['image_url']);
|
373 |
}
|
374 |
catch (\Exception $e) {}
|
|
|
375 |
|
376 |
+
$product->load('media_gallery');
|
377 |
+
|
378 |
+
$customData['images'] = array();
|
379 |
+
|
380 |
+
foreach ($product->getMediaGalleryImages() as $image)
|
381 |
+
$customData['images'][] = str_replace(array('https://', 'http://'), '//', $image->getUrl());
|
382 |
+
}
|
383 |
|
384 |
$sub_products = null;
|
385 |
$ids = null;
|
422 |
}, $sub_products);
|
423 |
}
|
424 |
|
425 |
+
if (count($ids)) {
|
426 |
+
$sub_products = $this->getProductCollectionQuery($product->getStoreId(), $ids, false)->load();
|
427 |
+
}
|
428 |
+
else {
|
429 |
+
$sub_products = array();
|
430 |
+
}
|
431 |
|
432 |
if ($product->getTypeId() == 'grouped' || $product->getTypeId() == 'configurable')
|
433 |
{
|
523 |
}
|
524 |
|
525 |
|
526 |
+
if (Mage::helper('core')->isModuleEnabled('Mage_Review'))
|
527 |
{
|
528 |
+
if ($this->isAttributeEnabled($additionalAttributes, 'rating_summary'))
|
529 |
+
{
|
530 |
+
$summaryData = Mage::getModel('review/review_summary')
|
531 |
+
->setStoreId($product->getStoreId())
|
532 |
+
->load($product->getId());
|
533 |
|
534 |
+
if ($summaryData['rating_summary'])
|
535 |
+
$customData['rating_summary'] = $summaryData['rating_summary'];
|
536 |
+
}
|
537 |
}
|
538 |
|
539 |
foreach ($additionalAttributes as $attribute)
|
558 |
|
559 |
foreach ($sub_products as $sub_product)
|
560 |
{
|
561 |
+
$stock = (int) $sub_product->getStockItem()->getIsInStock();
|
562 |
+
|
563 |
+
if ($stock == false)
|
564 |
+
continue;
|
565 |
+
|
566 |
$value = $sub_product->getData($attribute['attribute']);
|
567 |
|
568 |
if ($value)
|
578 |
|
579 |
if (count($values) > 0)
|
580 |
{
|
581 |
+
$customData[$attribute['attribute']] = array_values(array_unique($values));
|
582 |
}
|
583 |
}
|
584 |
}
|
602 |
}
|
603 |
}
|
604 |
|
605 |
+
$transport = new Varien_Object($customData);
|
606 |
+
Mage::dispatchEvent('algolia_subproducts_index', array('custom_data' => $transport, 'sub_products' => $sub_products));
|
607 |
+
$customData = $transport->getData();
|
608 |
+
|
609 |
$customData = array_merge($customData, $defaultData);
|
610 |
|
611 |
$customData['type_id'] = $product->getTypeId();
|
614 |
|
615 |
return $customData;
|
616 |
}
|
617 |
+
}
|
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algolia.php
CHANGED
@@ -9,6 +9,7 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
|
|
9 |
private $config;
|
10 |
|
11 |
public static $product_categories = array();
|
|
|
12 |
|
13 |
public function __construct()
|
14 |
{
|
@@ -231,7 +232,12 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
|
|
231 |
{
|
232 |
if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
|
233 |
{
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
235 |
return;
|
236 |
}
|
237 |
|
9 |
private $config;
|
10 |
|
11 |
public static $product_categories = array();
|
12 |
+
private static $credential_error = false;
|
13 |
|
14 |
public function __construct()
|
15 |
{
|
232 |
{
|
233 |
if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
|
234 |
{
|
235 |
+
if (self::$credential_error === false)
|
236 |
+
{
|
237 |
+
Mage::getSingleton('adminhtml/session')->addError('Algolia indexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
|
238 |
+
self::$credential_error = true;
|
239 |
+
}
|
240 |
+
|
241 |
return;
|
242 |
}
|
243 |
|
app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext.php
CHANGED
@@ -6,11 +6,13 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
|
|
6 |
/** Empty because we need it to do nothing (no mysql stuff), Indexing is handled by Model/Indexer/Algolia */
|
7 |
|
8 |
private $engine;
|
|
|
9 |
|
10 |
public function __construct()
|
11 |
{
|
12 |
parent::__construct();
|
13 |
$this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
|
|
|
14 |
}
|
15 |
|
16 |
public function prepareResult($object, $queryText, $query)
|
@@ -38,6 +40,12 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
|
|
38 |
*/
|
39 |
public function rebuildIndex($storeId = null, $productIds = null)
|
40 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/** Avoid Indexing twice */
|
42 |
if (is_array($productIds) && $productIds > 0)
|
43 |
return $this;
|
6 |
/** Empty because we need it to do nothing (no mysql stuff), Indexing is handled by Model/Indexer/Algolia */
|
7 |
|
8 |
private $engine;
|
9 |
+
private $config;
|
10 |
|
11 |
public function __construct()
|
12 |
{
|
13 |
parent::__construct();
|
14 |
$this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
|
15 |
+
$this->config = Mage::helper('algoliasearch/config');
|
16 |
}
|
17 |
|
18 |
public function prepareResult($object, $queryText, $query)
|
40 |
*/
|
41 |
public function rebuildIndex($storeId = null, $productIds = null)
|
42 |
{
|
43 |
+
if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
|
44 |
+
{
|
45 |
+
Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
/** Avoid Indexing twice */
|
50 |
if (is_array($productIds) && $productIds > 0)
|
51 |
return $this;
|
app/code/community/Algolia/Algoliasearch/etc/system.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<algoliasearch translate="label" module="algoliasearch">
|
5 |
<label>
|
6 |
<![CDATA[
|
7 |
-
Algolia Search 1.4.
|
8 |
<style>
|
9 |
.algoliasearch-admin-menu span {
|
10 |
padding-left: 38px !important;
|
4 |
<algoliasearch translate="label" module="algoliasearch">
|
5 |
<label>
|
6 |
<![CDATA[
|
7 |
+
Algolia Search 1.4.5
|
8 |
<style>
|
9 |
.algoliasearch-admin-menu span {
|
10 |
padding-left: 38px !important;
|
app/design/frontend/base/default/template/algoliasearch/topsearch.phtml
CHANGED
@@ -74,7 +74,7 @@ if ($config->isInstantEnabled())
|
|
74 |
|
75 |
$product_helper = Mage::helper('algoliasearch/entity_producthelper');
|
76 |
|
77 |
-
$hash_path = '#q='.htmlentities($query).'&page=0&refinements=%5B%5D&numerics_refinements=%7B%7D&index_name=%22'.$product_helper->getIndexName().'%22';
|
78 |
|
79 |
$refinement_key = Mage::app()->getRequest()->getParam('refinement_key');
|
80 |
$refinement_value = Mage::app()->getRequest()->getParam('refinement_value');
|
74 |
|
75 |
$product_helper = Mage::helper('algoliasearch/entity_producthelper');
|
76 |
|
77 |
+
$hash_path = '#q='.htmlentities($query, ENT_COMPAT, "UTF-8").'&page=0&refinements=%5B%5D&numerics_refinements=%7B%7D&index_name=%22'.$product_helper->getIndexName().'%22';
|
78 |
|
79 |
$refinement_key = Mage::app()->getRequest()->getParam('refinement_key');
|
80 |
$refinement_value = Mage::app()->getRequest()->getParam('refinement_value');
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>algoliasearch</name>
|
4 |
-
<version>1.4.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
|
7 |
<channel>community</channel>
|
@@ -11,12 +11,12 @@
|
|
11 |

|
12 |
This extension replaces Magento's FullText Search module and provide an as-you-type auto-completion menu in your searchbar.
|
13 |
</description>
|
14 |
-
<notes>-
|
15 |
-
- FIX:
|
16 |
<authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
|
17 |
-
<date>2015-09-
|
18 |
-
<time>
|
19 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="17a1452f533423291332642969b41a53"/></dir></target><target name="magecommunity"><dir name="Algolia"><dir name="Algoliasearch"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Additionalsections.php" hash="b2514910e3b56745e66239d5ee916331"/><file name="Custompages.php" hash="f87a9cf7b5559717cd9d6570374dcda7"/><file name="Customrankingcategory.php" hash="6d9575c12dbaecf9054de1cf12736025"/><file name="Customrankingproduct.php" hash="6d1b145e37c4f22d5b56f5783ac47511"/><file name="Customsortorder.php" hash="786c8f8fca2e4b41b8732f5fe270491b"/><file name="Customsortordercategory.php" hash="9908ea7f463138d3047c51b98591db9c"/><file name="Customsortorderproduct.php" hash="ee62901a3911bb7784467e1ca5cd8e84"/><file name="Facets.php" hash="097998767edeee986958f421979ea141"/><file name="Select.php" hash="6e3cb4c1798775048bebbdc878e90aa9"/><file name="Sorts.php" hash="fede73c4ecbe39bf0344fbf6de46ed95"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Algoliahelper.php" hash="ff48a4929fffd913da57868457ace02f"/><file name="Config.php" hash="2c4ccdf65066df3be068d87b4bbe3871"/><file name="Data.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>algoliasearch</name>
|
4 |
+
<version>1.4.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
|
7 |
<channel>community</channel>
|
11 |

|
12 |
This extension replaces Magento's FullText Search module and provide an as-you-type auto-completion menu in your searchbar.
|
13 |
</description>
|
14 |
+
<notes>- FIX: Improve performance issue when backend-search
|
15 |
+
- FIX: Various small improvements</notes>
|
16 |
<authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
|
17 |
+
<date>2015-09-21</date>
|
18 |
+
<time>07:30:36</time>
|
19 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="17a1452f533423291332642969b41a53"/></dir></target><target name="magecommunity"><dir name="Algolia"><dir name="Algoliasearch"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Additionalsections.php" hash="b2514910e3b56745e66239d5ee916331"/><file name="Custompages.php" hash="f87a9cf7b5559717cd9d6570374dcda7"/><file name="Customrankingcategory.php" hash="6d9575c12dbaecf9054de1cf12736025"/><file name="Customrankingproduct.php" hash="6d1b145e37c4f22d5b56f5783ac47511"/><file name="Customsortorder.php" hash="786c8f8fca2e4b41b8732f5fe270491b"/><file name="Customsortordercategory.php" hash="9908ea7f463138d3047c51b98591db9c"/><file name="Customsortorderproduct.php" hash="ee62901a3911bb7784467e1ca5cd8e84"/><file name="Facets.php" hash="097998767edeee986958f421979ea141"/><file name="Select.php" hash="6e3cb4c1798775048bebbdc878e90aa9"/><file name="Sorts.php" hash="fede73c4ecbe39bf0344fbf6de46ed95"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Algoliahelper.php" hash="ff48a4929fffd913da57868457ace02f"/><file name="Config.php" hash="2c4ccdf65066df3be068d87b4bbe3871"/><file name="Data.php" hash="791485161a9137bde154e17733dea674"/><dir name="Entity"><file name="Additionalsectionshelper.php" hash="5d20d805b31b7dec4feb943c5e6a96ef"/><file name="Categoryhelper.php" hash="0ec97836a0c1de3e3e22ce462fc756c7"/><file name="Helper.php" hash="3b6025b96ac4e41af10953f012abb77a"/><file name="Pagehelper.php" hash="7a0dcb237f6720d1637c48fc05a7d45e"/><file name="Producthelper.php" hash="6368487459472f135172e1a822115f84"/><file name="Suggestionhelper.php" hash="52f709b27a94c66aa9f7af8648dcb30a"/></dir></dir><dir name="Model"><dir name="Indexer"><file name="Algolia.php" hash="d0de03ed94ee19495fbb8703151c95f4"/><file name="Algoliaadditionalsections.php" hash="3113413441afccba3b8e79aa9fd8cdb1"/><file name="Algoliapages.php" hash="26ea3afee58d07b721c5cd74b3d6c4e3"/><file name="Algoliasuggestions.php" hash="7020d40bae60469d0acc7138ee72a419"/></dir><file name="Observer.php" hash="ebc42a95ceb718ff8dc7ed3e30c16e93"/><file name="Queue.php" hash="4e0c7559dd15b4cbd75cf41ab90f5bdf"/><dir name="Resource"><file name="Engine.php" hash="9322be8fe132f14a03540c4eb4cb5986"/><dir name="Fulltext"><file name="Collection.php" hash="66e8b9af58384bc3a99ee1464cbd3537"/></dir><file name="Fulltext.php" hash="64e54ab51992d455cce9f266db5b8802"/></dir><dir name="System"><file name="Removewords.php" hash="69c9727a324b657f7cfdf7f5d06e3cbc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ea4176ed43885e531f90d1f5369f29ee"/><file name="config.xml" hash="40c7c9ffb5140a758fd52723741fccf2"/><file name="system.xml" hash="677b7c93b67bf3372dc15920858cf2f4"/></dir><dir name="sql"><dir name="algoliasearch_setup"><file name="mysql4-install-0.1.0.php" hash="fffd964f9c60be7909ec216260c37ba0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="algoliasearch.xml" hash="f0df0b6ed09d186da4429577aefd346d"/></dir><dir name="template"><dir name="algoliasearch"><file name="topsearch.phtml" hash="27c656b0bc4d9ac9d1fbf12ef8cd9c8b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="algoliasearch"><file name="algolia-admin-menu.png" hash="9202a559c30a43d4d4bbc2f9ee774fd9"/><file name="algolia-logo.png" hash="190884b3e8652f3517754ae15bca31de"/><file name="algoliasearch.css" hash="1b85791da996184de93f54e54feca9c3"/><file name="bundle.css" hash="10df17cf0f50b56246a2ba017adcdae3"/><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="62568c006bb1066f40fd5f9cfe4489be"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="406541454ec466d93217826588335194"/><file name="ui-bg_flat_10_000000_40x100.png" hash="85243ed808c91ae60d33bda3a6bdee3c"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="f912ffca9b1919ab26c64cf1332c5322"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="a9b41e3f4db0fb9be1cd2c649deb253f"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="ff9e9b45e03f11808144324fd5350612"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="08ece8908c07b1c0d18b8db076ff50fc"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="72fe4b0e1bbb83dfd6787989d3583fbe"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="81262299ac7f591fd1763c1ccee0691f"/><file name="ui-icons_222222_256x240.png" hash="3a3c5468f484f07ac4a320d9e22acb8c"/><file name="ui-icons_228ef1_256x240.png" hash="92b29683b6a48eae7de7eb4b1cfa039c"/><file name="ui-icons_ef8c08_256x240.png" hash="f492970693640894fb54166c75dd2925"/><file name="ui-icons_ffd27a_256x240.png" hash="dda1b6f694b0d196aefc66a1d6d758f6"/><file name="ui-icons_ffffff_256x240.png" hash="41612b0f4a034424f8321c9f824a94da"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="algoliasearch"><file name="bundle.min.js" hash="50dc171cb2cbd89fda2a18a4b64e6e4c"/></dir></dir><dir name="lib"><dir name="AlgoliaSearch"><file name="AlgoliaException.php" hash="4acaa7c9142e19d1084295a3b8ba18e2"/><file name="Client.php" hash="11ad687a9868a9f574ae6a069800dd2c"/><file name="ClientContext.php" hash="77d2449636d263162460a7ccaea4e6b6"/><file name="Index.php" hash="5c1eacc54cd503bff296e9bbbd402895"/><file name="Version.php" hash="0c37eb6324361991364e0efd2696e56d"/><dir name="resources"><file name="ca-bundle.crt" hash="47961e7ef15667c93cd99be01b51f00a"/></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
skin/frontend/base/default/algoliasearch/algoliasearch.css
CHANGED
@@ -147,6 +147,13 @@
|
|
147 |
width: 200px;
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
#instant-search-bar-container {
|
151 |
width: 100%;
|
152 |
position: relative;
|
147 |
width: 200px;
|
148 |
}
|
149 |
|
150 |
+
#algolia_instant_selector .text-ellipsis
|
151 |
+
{
|
152 |
+
white-space: nowrap;
|
153 |
+
text-overflow: ellipsis;
|
154 |
+
overflow: hidden;
|
155 |
+
}
|
156 |
+
|
157 |
#instant-search-bar-container {
|
158 |
width: 100%;
|
159 |
position: relative;
|