[Groonga-commit] groonga/gcs [master] Sort elements in XML responses alphabetically

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 21日 (木) 16:47:58 JST


SHIMODA Hiroshi	2012-06-21 16:47:58 +0900 (Thu, 21 Jun 2012)

  New Revision: 249ed0c091246538b187c4b09d75fd784fc3cc7f
  https://github.com/groonga/gcs/commit/249ed0c091246538b187c4b09d75fd784fc3cc7f

  Log:
    Sort elements in XML responses alphabetically

  Modified files:
    lib/api/2011-02-01/configuration.js

  Modified: lib/api/2011-02-01/configuration.js (+27 -26)
===================================================================
--- lib/api/2011-02-01/configuration.js    2012-06-21 16:33:12 +0900 (af04073)
+++ lib/api/2011-02-01/configuration.js    2012-06-21 16:47:58 +0900 (f266d58)
@@ -30,26 +30,26 @@ function getBaseDomain(domain) {
 
 function createDomainStatus(options) {
   return '<DomainStatus>' +
-           '<SearchPartitionCount>' + (options.searchPartitionCount || 0) +
-             '</SearchPartitionCount>' +
-           '<SearchService>' +
-             '<Endpoint>' + (options.searchEndpoint || '') +'</Endpoint>' +
-           '</SearchService>' +
-           '<NumSearchableDocs>' + (options.searchableDocumentsCount || 0) +
-             '</NumSearchableDocs>' +
            '<Created>' + (options.created || 'false') + '</Created>' +
+           '<Deleted>' + (options.deleted || 'false') + '</Deleted>' +
+           '<DocService>' +
+             '<Endpoint>' + (options.documentsEndpoint || '') +'</Endpoint>' +
+           '</DocService>' +
            '<DomainId>' + options.domainName + '/' + options.domainName +
              '</DomainId>' +
-           '<SearchInstanceCount>' + (options.searchInstanceCount || 0) +
-             '</SearchInstanceCount>' +
            '<DomainName>' + options.domainName + '</DomainName>' +
+           '<NumSearchableDocs>' + (options.searchableDocumentsCount || 0) +
+             '</NumSearchableDocs>' +
            '<RequiresIndexDocuments>' +
              (options.requiresIndexDocuments || 'false') +
              '</RequiresIndexDocuments>' +
-           '<Deleted>' + (options.deleted || 'false') + '</Deleted>' +
-           '<DocService>' +
-             '<Endpoint>' + (options.documentsEndpoint || '') +'</Endpoint>' +
-           '</DocService>' +
+           '<SearchInstanceCount>' + (options.searchInstanceCount || 0) +
+             '</SearchInstanceCount>' +
+           '<SearchPartitionCount>' + (options.searchPartitionCount || 0) +
+             '</SearchPartitionCount>' +
+           '<SearchService>' +
+             '<Endpoint>' + (options.searchEndpoint || '') +'</Endpoint>' +
+           '</SearchService>' +
          '</DomainStatus>';
 }
 
@@ -91,7 +91,7 @@ handlers.CreateDomain = function(database, request, response) {
         searchEndpoint: 'http://search-' + domain.name + '-' + FAKE_DOMAIN_ID +
                         '/' + exports.version + '/search',
         documentsEndpoint: 'http://doc-' + domain.name + '-' + FAKE_DOMAIN_ID +
-                           '/' + exports.version + '/documents/batch',
+                           '/' + exports.version + '/documents',
         created: true,
         searchableDocumentsCount: 0,
         searchInstanceCount: 0,
@@ -108,27 +108,27 @@ handlers.CreateDomain = function(database, request, response) {
 
 function createIndexFieldStatus(options) {
   return '<IndexField>' +
-           '<Status>' +
-             '<CreationDate>' + dateFormat(options.createdAt,
-                                           'isoUtcDateTime') +
-               '</CreationDate>' +
-             '<UpdateVersion>' + (options.updateVersion || 0) +
-               '</UpdateVersion>' +
-             '<State>' + options.state + '</State>' +
-             '<UpdateDate>' + dateFormat(options.updatedAt, 'isoUtcDateTime') +
-               '</UpdateDate>' +
-           '</Status>' +
            '<Options>' +
-             '<IndexFieldType>' + options.fieldType + '</IndexFieldType>' +
              '<IndexFieldName>' + options.fieldName + '</IndexFieldName>' +
+             '<IndexFieldType>' + options.fieldType + '</IndexFieldType>' +
              '<TextOptions>' +
+               '<DefaultValue/>' +
                '<FacetEnabled>' + (options.facetEnabled || false) +
                  '</FacetEnabled>' +
                '<ResultEnabled>' + (options.resultEnabled || false) +
                  '</ResultEnabled>' +
-               '<DefaultValue/>' +
              '</TextOptions>' +
            '</Options>' +
+           '<Status>' +
+             '<CreationDate>' + dateFormat(options.createdAt,
+                                           'isoUtcDateTime') +
+               '</CreationDate>' +
+             '<State>' + options.state + '</State>' +
+             '<UpdateDate>' + dateFormat(options.updatedAt, 'isoUtcDateTime') +
+               '</UpdateDate>' +
+             '<UpdateVersion>' + (options.updateVersion || 0) +
+               '</UpdateVersion>' +
+           '</Status>' +
          '</IndexField>';
 }
 
@@ -136,6 +136,7 @@ function createDefineIndexFieldResponse(options) {
   return '<?xml version="1.0"?>\n' +
          '<DefineIndexFieldResponse xmlns="' + XMLNS + '">' +
            '<DefineIndexFieldResult>' +
+             createIndexFieldStatus(options) +
            '</DefineIndexFieldResult>' +
            '<ResponseMetadata>' +
              '<RequestId>' + (options.requestId || '') + '</RequestId>' +
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Back to archive index