Swiftype_Swiftype - Version 1.0.1

Version Notes

Changelog:

* Ensure custom search result ordering is based on order documents are returned in, rather than score.
* Ensure whitespace is removed from URI parameters.

Download this release

Release Info

Developer Swiftype
Extension Swiftype_Swiftype
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/community/Swiftype/Swiftype/Helper/Data.php CHANGED
@@ -245,6 +245,7 @@ class Swiftype_Swiftype_Helper_Data
245
  foreach ($params['uri'] as $name => $value) {
246
  $uri .= "/$name";
247
  if ($value) {
 
248
  $uri .= "/$value";
249
  }
250
  }
245
  foreach ($params['uri'] as $name => $value) {
246
  $uri .= "/$name";
247
  if ($value) {
248
+ $value = preg_replace('/\s+/', '', $value);
249
  $uri .= "/$value";
250
  }
251
  }
app/code/community/Swiftype/Swiftype/Model/Resource/Fulltext.php CHANGED
@@ -134,33 +134,17 @@ class Swiftype_Swiftype_Model_Resource_Fulltext
134
  final protected function _prepareResults(array $results, Mage_CatalogSearch_Model_Query $query)
135
  {
136
  $preparedResults = array();
137
- $resultCount = count($results);
138
- $customRelevance = false;
139
 
140
  foreach ($results as $result) {
141
  /* @var $result stdClass */
142
- $relevance = isset($result->_score) ? $result->_score : 0;
143
- // Indicates custom ordering
144
- if (!$relevance) {
145
- $customRelevance = true;
146
- break;
147
- }
148
- }
149
-
150
- foreach ($results as $result) {
151
- /* @var $result stdClass */
152
- $relevance = isset($result->_score) ? $result->_score : 0;
153
-
154
- if ($customRelevance) {
155
- $relevance = $resultCount;
156
- $resultCount--;
157
- }
158
-
159
  $preparedResults[] = array(
160
  'product_id' => (int)$result->product_id,
161
  'query_id' => (int)$query->getId(),
162
- 'relevance' => $relevance
163
  );
 
 
164
  }
165
 
166
  return $preparedResults;
134
  final protected function _prepareResults(array $results, Mage_CatalogSearch_Model_Query $query)
135
  {
136
  $preparedResults = array();
137
+ $customRelevance = count($results);
 
138
 
139
  foreach ($results as $result) {
140
  /* @var $result stdClass */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  $preparedResults[] = array(
142
  'product_id' => (int)$result->product_id,
143
  'query_id' => (int)$query->getId(),
144
+ 'relevance' => $customRelevance
145
  );
146
+
147
+ $customRelevance--;
148
  }
149
 
150
  return $preparedResults;
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Swiftype_Swiftype</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/agpl.html">AGPL</license>
7
  <channel>community</channel>
@@ -16,11 +16,12 @@
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
- * Bumped to 1.0.0 version in anticipation of Magento Connect initial release.</notes>
 
20
  <authors><author><name>Swiftype</name><user>swiftypeteam</user><email>team@swiftype.com</email></author></authors>
21
- <date>2014-06-12</date>
22
- <time>16:56:29</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="71cb37ad290d00ef577fb66b6cc8a0a5"/><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="c8117f47d91906e258d2000548befe1d"/></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="5c527591144181cc4615efd806a128d6"/></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.3.0</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.1</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
+ * Ensure custom search result ordering is based on order documents are returned in, rather than score.&#xD;
20
+ * Ensure whitespace is removed from URI parameters.</notes>
21
  <authors><author><name>Swiftype</name><user>swiftypeteam</user><email>team@swiftype.com</email></author></authors>
22
+ <date>2014-06-25</date>
23
+ <time>17:30:57</time>
24
+ <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="7240ab186b3fb12e03939f202173265a"/><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="7140192d2aa3434b9b0bbfe66b939b8e"/></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="5c527591144181cc4615efd806a128d6"/></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>
25
  <compatible/>
26
  <dependencies><required><php><min>5.3.0</min><max>5.7.0</max></php></required></dependencies>
27
  </package>