Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
2.1.1 - 2015-06-19
Browse files Browse the repository at this point in the history
  * FIX : #107 Apply rules to distinct to prevent the API to return an error
  * FIX : make algoliasearch-helper requireable + browserifyable by
    removing the global envify transform
  • Loading branch information
vvo committed Jun 19, 2015
1 parent c87da37 commit cc3962c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CHANGELOG

unreleased
2.1.1 - 2015-06-19
* FIX : #107 Apply rules to distinct to prevent the API to return an error
* FIX : make algoliasearch-helper requireable + browserifyable by remvoving the global envify transform
* FIX : make algoliasearch-helper requireable + browserifyable by removing the global envify transform

2.1.0 - 2015-06-15
* FIX : #29 Avoid callback for outdated queries
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algoliasearch-helper",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "https://github.com/algolia/algoliasearch-helper-js",
"authors": [
"Algolia Team <support@algolia.com>"
Expand Down
19 changes: 14 additions & 5 deletions dist/algoliasearch.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function algoliasearchHelper( client, index, opts ) {
* The version currently used
* @member module:algoliasearchHelper.version
*/
algoliasearchHelper.version = "2.1.0";
algoliasearchHelper.version = "2.1.1";

/**
* Constructor for the Helper.
Expand Down Expand Up @@ -6777,17 +6777,18 @@ AlgoliaSearchHelper.prototype._handleResponse = function( state, queryId, err, c
* @return {object.<string, any>}
*/
AlgoliaSearchHelper.prototype._getHitsSearchParams = function() {
var query = this.state.query;
var facets = this.state.facets.concat( this.state.disjunctiveFacets );
var facetFilters = this._getFacetFilters();
var numericFilters = this._getNumericFilters();
var tagFilters = this._getTagFilters();
var additionalParams = {
facets : facets,
tagFilters : tagFilters,
distinct : this.state.distinct || false
distinct : this.state.distinct
};

if( !this.state.query && facetFilters.length === 0 && numericFilters.length === 0 && tagFilters.length === 0 ) {
if( !this.containsRefinement( query, facetFilters, numericFilters, tagFilters ) ) {
additionalParams.distinct = false;
}

Expand All @@ -6809,6 +6810,7 @@ AlgoliaSearchHelper.prototype._getHitsSearchParams = function() {
* @return {object}
*/
AlgoliaSearchHelper.prototype._getDisjunctiveFacetSearchParams = function( facet ) {
var query = this.state.query;
var facetFilters = this._getFacetFilters( facet );
var numericFilters = this._getNumericFilters( facet );
var tagFilters = this._getTagFilters();
Expand All @@ -6820,10 +6822,10 @@ AlgoliaSearchHelper.prototype._getDisjunctiveFacetSearchParams = function( facet
attributesToSnippet : [],
facets : facet,
tagFilters : tagFilters,
distinct : this.state.distinct || false
distinct : this.state.distinct
};

if( !this.state.query && facetFilters.length === 0 && numericFilters.length === 0 && tagFilters.length === 0 ) {
if( !this.containsRefinement( query, facetFilters, numericFilters, tagFilters ) ) {
additionalParams.distinct = false;
}

Expand All @@ -6838,6 +6840,13 @@ AlgoliaSearchHelper.prototype._getDisjunctiveFacetSearchParams = function( facet
return extend( this.state.getQueryParams(), additionalParams );
};

AlgoliaSearchHelper.prototype.containsRefinement = function( query, facetFilters, numericFilters, tagFilters ) {
return query ||
facetFilters.length !== 0 ||
numericFilters.length !== 0 ||
tagFilters.length !== 0;
};

/**
* Return the numeric filters in an algolia request fashion
* @private
Expand Down
4 changes: 2 additions & 2 deletions dist/algoliasearch.helper.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function algoliasearchHelper( client, index, opts ) {
* The version currently used
* @member module:algoliasearchHelper.version
*/
algoliasearchHelper.version = "2.1.0";
algoliasearchHelper.version = "2.1.1";

/**
* Constructor for the Helper.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algoliasearch-helper",
"version": "2.1.0",
"version": "2.1.1",
"description": "Helper for implementing advanced search features with algolia",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit cc3962c

Please sign in to comment.