[Groonga-commit] groonga/gcs [master] Don't throw error if searchEnabled/resultEnabled/facetEnabled are not changed

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Thu Aug 23 14:35:12 JST 2012


YUKI Hiroshi	2012-08-23 14:35:12 +0900 (Thu, 23 Aug 2012)

  New Revision: c9b67ab30275e7fa617eea8c9b552b6dec555284
  https://github.com/groonga/gcs/commit/c9b67ab30275e7fa617eea8c9b552b6dec555284

  Log:
    Don't throw error if searchEnabled/resultEnabled/facetEnabled are not changed

  Modified files:
    lib/database/index-field.js

  Modified: lib/database/index-field.js (+9 -5)
===================================================================
--- lib/database/index-field.js    2012-08-23 14:32:30 +0900 (be166d1)
+++ lib/database/index-field.js    2012-08-23 14:35:12 +0900 (553964e)
@@ -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) {
@@ -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;
@@ -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) {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index