Swiftype_Swiftype - Version 1.0.5

Version Notes

Changelog:

* Added spelling option.

Download this release

Release Info

Developer Swiftype
Extension Swiftype_Swiftype
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

app/code/community/Swiftype/Swiftype/Helper/Data.php CHANGED
@@ -16,7 +16,9 @@ class Swiftype_Swiftype_Helper_Data
16
  const DOCUMENT_FIELD_TYPE_FLOAT = 'float';
17
  const DOCUMENT_FIELD_TYPE_DATE = 'date';
18
  const DOCUMENT_FIELD_TYPE_LOCATION = 'location';
19
-
 
 
20
 
21
  final public function handleException(Exception $exception, $throw = false, $log = true)
22
  {
@@ -312,7 +314,16 @@ class Swiftype_Swiftype_Helper_Data
312
  {
313
  return Mage::getStoreConfig('catalog/search/swiftype_autocomplete_limit', $store);
314
  }
315
-
 
 
 
 
 
 
 
 
 
316
  final public function getUseSwiftypeAutocomplete($store = null)
317
  {
318
  if (!$this->getUseSwiftype()) {
16
  const DOCUMENT_FIELD_TYPE_FLOAT = 'float';
17
  const DOCUMENT_FIELD_TYPE_DATE = 'date';
18
  const DOCUMENT_FIELD_TYPE_LOCATION = 'location';
19
+
20
+ const NO_SPELLING_OPTION = 'no';
21
+ const RETRY_SPELLING_OPTION = 'retry';
22
 
23
  final public function handleException(Exception $exception, $throw = false, $log = true)
24
  {
314
  {
315
  return Mage::getStoreConfig('catalog/search/swiftype_autocomplete_limit', $store);
316
  }
317
+
318
+ final public function getSpelling($store = null)
319
+ {
320
+ if (!$this->getUseSwiftype()) {
321
+ return false;
322
+ }
323
+
324
+ return Mage::getStoreConfig('catalog/search/swiftype_spelling', $store);
325
+ }
326
+
327
  final public function getUseSwiftypeAutocomplete($store = null)
328
  {
329
  if (!$this->getUseSwiftype()) {
app/code/community/Swiftype/Swiftype/Model/Resource/Fulltext.php CHANGED
@@ -84,18 +84,26 @@ class Swiftype_Swiftype_Model_Resource_Fulltext
84
  {
85
  $storeId = $query->getStoreId();
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  $swiftypeApiParameters = array(
88
  'uri' => array(
89
  'engines' => $this->_getHelper()->getEngineSlug($storeId),
90
  'document_types' => Swiftype_Swiftype_Helper_Data::DOCUMENT_TYPE,
91
  'search' => null
92
  ),
93
- 'get' => array(
94
- 'auth_token' => $this->_getHelper()->getAuthToken($storeId),
95
- 'q' => $this->_getQueryText($query),
96
- 'per_page' => self::PER_PAGE,
97
- 'page' => $page
98
- )
99
  );
100
 
101
  $swiftypeApiClient = $this->_getHelper()->getSwiftypeClient($swiftypeApiParameters);
84
  {
85
  $storeId = $query->getStoreId();
86
 
87
+ $getParams = array(
88
+ 'auth_token' => $this->_getHelper()->getAuthToken($storeId),
89
+ 'q' => $this->_getQueryText($query),
90
+ 'per_page' => self::PER_PAGE,
91
+ 'page' => $page
92
+ );
93
+
94
+ $spelling = $this->_getHelper()->getSpelling($storeId);
95
+
96
+ if ($spelling === Swiftype_Swiftype_Helper_Data::RETRY_SPELLING_OPTION) {
97
+ $getParams['spelling'] = Swiftype_Swiftype_Helper_Data::RETRY_SPELLING_OPTION;
98
+ }
99
+
100
  $swiftypeApiParameters = array(
101
  'uri' => array(
102
  'engines' => $this->_getHelper()->getEngineSlug($storeId),
103
  'document_types' => Swiftype_Swiftype_Helper_Data::DOCUMENT_TYPE,
104
  'search' => null
105
  ),
106
+ 'get' => $getParams
 
 
 
 
 
107
  );
108
 
109
  $swiftypeApiClient = $this->_getHelper()->getSwiftypeClient($swiftypeApiParameters);
app/code/community/Swiftype/Swiftype/Model/System/Config/Source/Catalog/Search/Spelling.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ final class Swiftype_Swiftype_Model_System_Config_Source_Catalog_Search_Spelling
4
+ {
5
+ final public function toOptionArray()
6
+ {
7
+ return array(
8
+ array(
9
+ 'value' => Swiftype_Swiftype_Helper_Data::NO_SPELLING_OPTION,
10
+ 'label' => 'No'
11
+ ),
12
+ array(
13
+ 'value' => Swiftype_Swiftype_Helper_Data::RETRY_SPELLING_OPTION,
14
+ 'label' => 'Yes'
15
+ )
16
+ );
17
+ }
18
+ }
app/code/community/Swiftype/Swiftype/etc/system.xml CHANGED
@@ -86,6 +86,21 @@
86
  </depends>
87
  <validate>validate-number</validate>
88
  </swiftype_autocomplete_limit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  </fields>
90
  </search>
91
  </groups>
86
  </depends>
87
  <validate>validate-number</validate>
88
  </swiftype_autocomplete_limit>
89
+ <swiftype_spelling>
90
+ <label>Use Swiftype Spelling Correction</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>swiftype/system_config_source_catalog_search_spelling</source_model>
93
+ <sort_order>60</sort_order>
94
+ <show_in_default>0</show_in_default>
95
+ <show_in_website>0</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ <depends>
98
+ <engine>swiftype/fulltext_engine</engine>
99
+ </depends>
100
+ <comment>
101
+ <![CDATA[Only available to Business level and above customers. Visit <a href='https://swiftype.com/pricing' target='_blank'>pricing page</a> to learn more and upgrade.]]>
102
+ </comment>
103
+ </swiftype_spelling>
104
  </fields>
105
  </search>
106
  </groups>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Swiftype_Swiftype</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/agpl.html">AGPL</license>
7
  <channel>community</channel>
@@ -16,11 +16,11 @@
16
  * Autocomplete: Sometimes a search isn't even necessary; our search engines come with autocomplete built-in, and your users will thank you for having it.</description>
17
  <notes>Changelog:&#xD;
18
  &#xD;
19
- * Lower minimum PHP version to lowest supported PHP version for Magento (5.2.13)</notes>
20
  <authors><author><name>Swiftype</name><user>swiftypeteam</user><email>team@swiftype.com</email></author></authors>
21
- <date>2014-07-01</date>
22
- <time>17:32:32</time>
23
- <contents><target name="magecommunity"><dir name="Swiftype"><dir name="Swiftype"><dir name="Block"><dir name="Ajax"><file name="Suggest.php" hash="e5b55a9c41709eeffe31a6ea266876bc"/></dir><file name="Autocomplete.php" hash="f42063444facdccc951700591a82f8ca"/></dir><dir name="Helper"><file name="Data.php" hash="e620dce46e1af6183cb135f966656fba"/><file name="Log.php" hash="544a2a7075d3dec2d8c81eef0656f8a4"/></dir><dir name="Model"><dir name="Observer"><file name="Adminhtml.php" hash="6a1420a1fe9c7a7d7f3b90b5260af196"/><file name="Frontend.php" hash="923f4348d2b2785dfca43df9f2355e40"/><file name="Global.php" hash="8764a09f34b456cb729543616e0de889"/></dir><dir name="Request"><file name="Processor.php" hash="ca7fbb10d1dc0920ddb9605f7c9e310c"/></dir><dir name="Resource"><dir name="Fulltext"><file name="Engine.php" hash="5d95d1b7ea2d13c05478c4fec69d27d5"/></dir><file name="Fulltext.php" hash="2603cb525d5516bd03b657caa6cf1169"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Search"><file name="Engine.php" hash="a9faa3a31d39cedf2e20fa6e50cc1a66"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="0d61e11d4d332041f75981304546ff1b"/><file name="AnalyticsController.php" hash="8c8742944ddcf89182f6a03f49e747c4"/></dir><dir name="etc"><file name="config.xml" hash="3227643a18db99d75417eea199ed136c"/><file name="system.xml" hash="a372d79b32358f00aac38cf8864ca715"/></dir><dir name="sql"><dir name="swiftype_setup"><file name="install-1.php" hash="720c6d503a3493b9be8e34ff9af49528"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="swiftype.xml" hash="b32acb6177dbf205ede8e0b0c2601705"/></dir><dir name="template"><dir name="swiftype"><dir name="ajax"><file name="suggest.phtml" hash="bd7164f8033e2157adb4127e4eacde26"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Swiftype_Swiftype.xml" hash="6894235a6d3edae4c2f5aa04407274d6"/></dir><dir name="."><file name="swiftype.xml" hash="20e640f1fa6945f853c2d29e3c2f94d9"/></dir></target></contents>
24
  <compatible/>
25
  <dependencies><required><php><min>5.2.13</min><max>5.7.0</max></php></required></dependencies>
26
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Swiftype_Swiftype</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/agpl.html">AGPL</license>
7
  <channel>community</channel>
16
  * Autocomplete: Sometimes a search isn't even necessary; our search engines come with autocomplete built-in, and your users will thank you for having it.</description>
17
  <notes>Changelog:&#xD;
18
  &#xD;
19
+ * Added spelling option.</notes>
20
  <authors><author><name>Swiftype</name><user>swiftypeteam</user><email>team@swiftype.com</email></author></authors>
21
+ <date>2014-09-03</date>
22
+ <time>18:25:57</time>
23
+ <contents><target name="magecommunity"><dir name="Swiftype"><dir name="Swiftype"><dir name="Block"><dir name="Ajax"><file name="Suggest.php" hash="e5b55a9c41709eeffe31a6ea266876bc"/></dir><file name="Autocomplete.php" hash="f42063444facdccc951700591a82f8ca"/></dir><dir name="Helper"><file name="Data.php" hash="d826082497f66983bf6562dc25c51786"/><file name="Log.php" hash="544a2a7075d3dec2d8c81eef0656f8a4"/></dir><dir name="Model"><dir name="Observer"><file name="Adminhtml.php" hash="6a1420a1fe9c7a7d7f3b90b5260af196"/><file name="Frontend.php" hash="923f4348d2b2785dfca43df9f2355e40"/><file name="Global.php" hash="8764a09f34b456cb729543616e0de889"/></dir><dir name="Request"><file name="Processor.php" hash="ca7fbb10d1dc0920ddb9605f7c9e310c"/></dir><dir name="Resource"><dir name="Fulltext"><file name="Engine.php" hash="5d95d1b7ea2d13c05478c4fec69d27d5"/></dir><file name="Fulltext.php" hash="f10a4fe39287a9a937c6b2db70de5211"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Search"><file name="Engine.php" hash="a9faa3a31d39cedf2e20fa6e50cc1a66"/><file name="Spelling.php" hash="1bd4db5a89eb63ead9de87b1578baded"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="0d61e11d4d332041f75981304546ff1b"/><file name="AnalyticsController.php" hash="8c8742944ddcf89182f6a03f49e747c4"/></dir><dir name="etc"><file name="config.xml" hash="3227643a18db99d75417eea199ed136c"/><file name="system.xml" hash="310d71eaaa4034e3fbbf4648958fe152"/></dir><dir name="sql"><dir name="swiftype_setup"><file name="install-1.php" hash="720c6d503a3493b9be8e34ff9af49528"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="swiftype.xml" hash="b32acb6177dbf205ede8e0b0c2601705"/></dir><dir name="template"><dir name="swiftype"><dir name="ajax"><file name="suggest.phtml" hash="bd7164f8033e2157adb4127e4eacde26"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Swiftype_Swiftype.xml" hash="6894235a6d3edae4c2f5aa04407274d6"/></dir><dir name="."><file name="swiftype.xml" hash="20e640f1fa6945f853c2d29e3c2f94d9"/></dir></target></contents>
24
  <compatible/>
25
  <dependencies><required><php><min>5.2.13</min><max>5.7.0</max></php></required></dependencies>
26
  </package>