Skip to content

Commit

Permalink
Don't throw error if searchEnabled/resultEnabled/facetEnabled are not…
Browse files Browse the repository at this point in the history
… changed
  • Loading branch information
piroor committed Aug 23, 2012
1 parent 354073b commit c9b67ab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/database/index-field.js
Expand Up @@ -157,10 +157,11 @@ IndexField.prototype = {
return !!(this._facetEnabled = value);
},
set facetEnabled(value) {
if (this.type == 'uint')
var booleanValue = !!value;
if (booleanValue != this.facetEnabled && this.type == 'uint')
throw new Error('facet option cannot be configured for the type ' + this.type + '.');

this._facetEnabled = !!value;
this._facetEnabled = booleanValue;
return value;
},
setFacetEnabled: function(value) {
Expand All @@ -182,7 +183,8 @@ IndexField.prototype = {
return !!(this._resultEnabled = value);
},
set resultEnabled(value) {
if (this.type == 'uint')
var booleanValue = !!value;
if (booleanValue != this.resultEnabled && this.type == 'uint')
throw new Error('returnable option cannot be configured for the type ' + this.type + '.');

this._resultEnabled = !!value;
Expand All @@ -207,10 +209,12 @@ IndexField.prototype = {
return !!(this._searchEnabled = value);
},
set searchEnabled(value) {
if (this.type == 'text' || this.type == 'uint')
var booleanValue = !!value;
if (booleanValue != this.searchEnabled &&
(this.type == 'text' || this.type == 'uint'))
throw new Error('searchable option cannot be configured for the type ' + this.type + '.');

this._searchEnabled = !!value;
this._searchEnabled = booleanValue;
return value;
},
setSearchEnabled: function(value) {
Expand Down

0 comments on commit c9b67ab

Please sign in to comment.