YUKI Hiroshi
null+****@clear*****
Wed Oct 17 17:42:08 JST 2012
YUKI Hiroshi 2012-10-17 17:42:08 +0900 (Wed, 17 Oct 2012) New Revision: 53a38fc0c947f4cba45894226e5c3fa4a6b3f3e5 https://github.com/groonga/gcs/commit/53a38fc0c947f4cba45894226e5c3fa4a6b3f3e5 Log: Fix usage of DefineIndexField action Modified files: bin/gcs-configure-fields test/gcs-commands.test.js Modified: bin/gcs-configure-fields (+6 -4) =================================================================== --- bin/gcs-configure-fields 2012-10-17 17:41:45 +0900 (2163705) +++ bin/gcs-configure-fields 2012-10-17 17:42:08 +0900 (fbacf47) @@ -47,7 +47,7 @@ function doDelete(field) { client.configurationAPI.DeleteIndexField( { DomainName: client.domainName, - 'IndexField.IndexFieldName': fieldName + IndexFieldName: fieldName }, function(error, response) { if (error) @@ -79,12 +79,12 @@ client.getIndexFieldStatus(fieldName, function(error, field) { return doDelete(field); var type = commandLine.options.type; - if (type && field) + if (!type && field) type = field.Options.IndexFieldType; if (!field) { if (!type) - client.raiseFatalErrlr('You must specify the field type.'); + client.raiseFatalError('You must specify the field type.'); } else if (!option) { client.raiseFatalError('You must specify the configuring option.'); } @@ -99,7 +99,7 @@ client.getIndexFieldStatus(fieldName, function(error, field) { } var params = { - domainName: client.domainName, + DomainName: client.domainName, IndexField: { IndexFieldName: fieldName, IndexFieldType: type @@ -118,6 +118,7 @@ client.getIndexFieldStatus(fieldName, function(error, field) { default: client.raiseFatalError('invalid field option ' + option); } + switch (type) { case 'text': if (option == 'nosearch') @@ -141,6 +142,7 @@ client.getIndexFieldStatus(fieldName, function(error, field) { } } + client.configurationAPI.DefineIndexField(params, function(error, response) { if (error) client.raiseFatalError(error); Modified: test/gcs-commands.test.js (+11 -11) =================================================================== --- test/gcs-commands.test.js 2012-10-17 17:41:45 +0900 (6d2570d) +++ test/gcs-commands.test.js 2012-10-17 17:42:08 +0900 (0fe719c) @@ -291,7 +291,7 @@ suite('gcs-configure-fields', function() { { code: 0, message: 'Updated 1 Index Field:\n' + name + ' Active ' + type + ' (' + options + ')\n' }, - result.output.stderr); + result.output.stderr + [result, name, type, options]); } function testCreateField(done, name, type, options) { @@ -487,7 +487,7 @@ suite('gcs-configure-fields', function() { assertSuccess(result, name, type, options); context.reopen(); var field = new Domain('companies', context).getIndexField(name); - assert.equal(field.options, options); + assert.equal(field.options, options, [result, name, type, options]); } function testConfigureFieldOptions(type, results, done) { @@ -578,10 +578,10 @@ suite('gcs-configure-fields', function() { testConfigureFieldOptions('text', { search: 'Search', nosearch: 'error', - facet: 'Search Facet', - nofacet: 'Search', result: 'Search Result', - noresult: 'Search' + noresult: 'Search', + facet: 'Search Facet', + nofacet: 'Search' }, done); }); @@ -589,10 +589,10 @@ suite('gcs-configure-fields', function() { testConfigureFieldOptions('uint', { search: 'Search Result', nosearch: 'error', - facet: 'error', - nofacet: 'Search Result', result: 'Search Result', - noresult: 'error' + noresult: 'error', + facet: 'error', + nofacet: 'Search Result' }, done); }); @@ -600,10 +600,10 @@ suite('gcs-configure-fields', function() { testConfigureFieldOptions('literal', { search: 'Search', nosearch: '', - facet: 'Facet', - nofacet: '', result: 'Result', - noresult: '' + noresult: '', + facet: 'Facet', + nofacet: '' }, done); }); }); -------------- next part -------------- HTML����������������������������... Download