diff --git a/src/requestBuilder.js b/src/requestBuilder.js index c1ac9f25f..504d684a6 100644 --- a/src/requestBuilder.js +++ b/src/requestBuilder.js @@ -118,16 +118,16 @@ var requestBuilder = { var numericFilters = requestBuilder._getNumericFilters(state, facet); var tagFilters = requestBuilder._getTagFilters(state); var additionalParams = { - hitsPerPage: 1, + hitsPerPage: 0, page: 0, - attributesToRetrieve: [], - attributesToHighlight: [], - attributesToSnippet: [], - tagFilters: tagFilters, analytics: false, clickAnalytics: false }; + if (tagFilters.length > 0) { + additionalParams.tagFilters = tagFilters; + } + var hierarchicalFacet = state.getHierarchicalFacetByName(facet); if (hierarchicalFacet) { diff --git a/test/spec/requestBuilder.js b/test/spec/requestBuilder.js index c04a00e79..fc047fbf1 100644 --- a/test/spec/requestBuilder.js +++ b/test/spec/requestBuilder.js @@ -125,44 +125,35 @@ test('orders parameters alphabetically in every query', function() { })); expect(JSON.stringify(queries[1].params)).toBe(JSON.stringify({ analytics: false, - attributesToHighlight: [], attributesToRetrieve: ['this is last in parameters, but first in queries'], - attributesToSnippet: [], clickAnalytics: false, facetFilters: [['whatever:item']], facets: 'test_disjunctive', - hitsPerPage: 1, + hitsPerPage: 0, numericFilters: ['test_numeric>=10'], - page: 0, - tagFilters: '' + page: 0 })); expect(JSON.stringify(queries[2].params)).toBe(JSON.stringify({ analytics: false, - attributesToHighlight: [], attributesToRetrieve: ['this is last in parameters, but first in queries'], - attributesToSnippet: [], clickAnalytics: false, facetFilters: [ ['test_disjunctive:test_disjunctive_value'], ['whatever:item'] ], facets: 'test_numeric', - hitsPerPage: 1, - page: 0, - tagFilters: '' + hitsPerPage: 0, + page: 0 })); expect(JSON.stringify(queries[3].params)).toBe(JSON.stringify({ analytics: false, - attributesToHighlight: [], attributesToRetrieve: ['this is last in parameters, but first in queries'], - attributesToSnippet: [], clickAnalytics: false, facetFilters: [['test_disjunctive:test_disjunctive_value']], facets: ['whatever'], - hitsPerPage: 1, + hitsPerPage: 0, numericFilters: ['test_numeric>=10'], - page: 0, - tagFilters: '' + page: 0 })); });