[Groonga-commit] groonga/gcs [master] Define IndexField#summary

Back to archive index

SHIMODA Hiroshi null+****@clear*****
Wed Aug 15 14:41:59 JST 2012


SHIMODA Hiroshi	2012-08-15 14:41:59 +0900 (Wed, 15 Aug 2012)

  New Revision: 2142681e71e042abd309a8c85b856e9e19b2694c
  https://github.com/groonga/gcs/commit/2142681e71e042abd309a8c85b856e9e19b2694c

  Log:
    Define IndexField#summary

  Modified files:
    bin/gcs-configure-fields
    bin/gcs-describe-domain
    lib/database/index-field.js
    test/database-index-field.test.js
    test/gcs-commands.test.js

  Modified: bin/gcs-configure-fields (+1 -1)
===================================================================
--- bin/gcs-configure-fields    2012-08-15 14:02:39 +0900 (8921326)
+++ bin/gcs-configure-fields    2012-08-15 14:41:59 +0900 (bc3db52)
@@ -84,5 +84,5 @@ if (commandLine.options.delete) {
     field.saveOptionsSync();
 
   console.log('Updated 1 Index Field:');
-  console.log('%s %s %s (%s)', field.name, field.state, field.type, field.options);
+  console.log(field.summary);
 }

  Modified: bin/gcs-describe-domain (+1 -2)
===================================================================
--- bin/gcs-describe-domain    2012-08-15 14:02:39 +0900 (33032aa)
+++ bin/gcs-describe-domain    2012-08-15 14:41:59 +0900 (7f91102)
@@ -42,8 +42,7 @@ function report(domain) {
   console.log('Fields:');
   console.log('=======');
   domain.indexFields.forEach(function(field) {
-    console.log('%s %s %s (%s)',
-                field.name, field.state, field.type, field.options);
+    console.log(field.summary);
   });
   console.log('======================');
 }

  Modified: lib/database/index-field.js (+5 -0)
===================================================================
--- lib/database/index-field.js    2012-08-15 14:02:39 +0900 (44fab14)
+++ lib/database/index-field.js    2012-08-15 14:41:59 +0900 (988028b)
@@ -248,6 +248,11 @@ IndexField.prototype = {
     return 'Active';
   },
 
+  get summary() {
+    return this.name + ' ' + this.state + ' ' +
+             this.type + ' (' + this.options + ')';
+  },
+
   get multipleValues() {
     return !!this.column &&
            this.column.flags.indexOf(nroonga.COLUMN_VECTOR) > -1;

  Modified: test/database-index-field.test.js (+12 -0)
===================================================================
--- test/database-index-field.test.js    2012-08-15 14:02:39 +0900 (dc8a5aa)
+++ test/database-index-field.test.js    2012-08-15 14:41:59 +0900 (7175372)
@@ -156,6 +156,18 @@ suite('database', function() {
       });
     });
 
+    test('summary', function() {
+      var textField =    new IndexField('name', domain).setType('text');
+      var uintField =    new IndexField('age', domain).setType('uint');
+      var literalField = new IndexField('product', domain).setType('literal');
+      assert.deepEqual({ text:    textField.summary,
+                         uint:    uintField.summary,
+                         literal: literalField.summary },
+                       { text:    'name Active text (Search)',
+                         uint:    'age Active uint (Facet Result)',
+                         literal: 'product Active literal ()' });
+    });
+
     suite('getting data from database', function() {
       var temporaryDatabase;
       var context;

  Modified: test/gcs-commands.test.js (+2 -4)
===================================================================
--- test/gcs-commands.test.js    2012-08-15 14:02:39 +0900 (f0e372b)
+++ test/gcs-commands.test.js    2012-08-15 14:41:59 +0900 (101896e)
@@ -200,10 +200,8 @@ suite('gcs-describe-domain', function() {
                              '\n' +
                              'Fields:\n' +
                              '=======\n' +
-                             ageField.name + ' ' + ageField.state + ' ' +
-                               ageField.type + ' (' + ageField.options + ')\n' +
-                             nameField.name + ' ' + nameField.state + ' ' +
-                               nameField.type + ' (' + nameField.options + ')\n' +
+                             ageField.summary\n' +
+                             nameField.summary\n' +
                              '======================\n' });
 
         done();
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index