Skip to content

Conversation

santosh1994
Copy link
Contributor

@rahulcs @floydpraveen Please review.
handles #41

@santosh1994 santosh1994 force-pushed the range-fix branch 2 times, most recently from 0df66f1 to 0bd4a80 Compare December 26, 2016 10:16
var rangeFacet = processedParams.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['ub'] is better written in dot notation.

var rangeFacet = processedParams.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['ub'] is better written in dot notation.


var rangeFacet = processedParams.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['lb'] is better written in dot notation.


var rangeFacet = processedParams.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['lb'] is better written in dot notation.

var rangeField = 'price_fq';
var start = 5;
var end = 10;
var filter = rangeField + ":[" + start + " TO " + end + "}";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.

var rangeField = 'price_fq';
var start = 5;
var end = 10;
var filter = rangeField + ":[" + start + " TO " + end + "}";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.

var rangeFacet = this.searchobj.params.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['ub'] is better written in dot notation.

var rangeFacet = this.searchobj.params.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['ub'] is better written in dot notation.

@@ -115,6 +115,10 @@ describe('Facets', function () {
this.searchobj.addRangeFilter(rangeField,start,end);
expect(this.searchobj.params.ranges[rangeField][start + ' TO ' + end])
.to.exist;
var rangeFacet = this.searchobj.params.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['lb'] is better written in dot notation.

@@ -115,6 +115,10 @@ describe('Facets', function () {
this.searchobj.addRangeFilter(rangeField,start,end);
expect(this.searchobj.params.ranges[rangeField][start + ' TO ' + end])
.to.exist;
var rangeFacet = this.searchobj.params.ranges[rangeField];
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true;
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['lb'] is better written in dot notation.

@@ -1265,7 +1265,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
for(var x = 0; x < filterStrArr.length; x++){
var arr = filterStrArr[x].split(":");
if(arr.length == 2){
arr[1] = arr[1].replace(/(^")|("$)/g, '').replace(/\"{2,}/g, '"').replace(/\\\"/g, '"').replace(/(^\[)|(\]$)/g, '');
arr[1] = arr[1].replace(/(^")|("$)/g, '').replace(/\"{2,}/g, '"').replace(/\\\"/g, '"').replace(/(^\[)|(\]$)|(\}$)/g, '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Range facet in search metadata will now be in format filter: "price_fq:[30 TO 60}"
It will start with square bracket & end with flower bracket

}else if(this.params.ranges[x].hasOwnProperty(y)){
a.push(x + ':[' + this.params.ranges[x][y].lb + " TO " + this.params.ranges[x][y].ub + ']');
a.push(x + ':[' + this.params.ranges[x][y].lb + " TO " + this.params.ranges[x][y].ub + '}');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's starts with square bracket & end with flower bracket?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

square bracket -> Include interval
flower bracket -> Exclude interval

Currently we are apply filter including both upper and lower Interval. But in facets response, it returns count of products under Start >= product < End

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants