Skip to content

Apache Lucene open-source search software

SOLR-9002: Fix type mapping for JSON and text This is for the Admin UI's collection/File screen

Alexandre Rafalovitch97dc5a2a0bd2
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index cf934481af9..3c54bad0d76 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -211,6 +211,9 @@ Bug Fixes
* SOLR-8715: Admin UI's Schema screen now works for fields with stored=false and some content indexed (Alexandre Rafalovitch)
* SOLR-8911: In Admin UI, enable scrolling for overflowing Versions and JVM property values
+
+* SOLR-9002: Admin UI now correctly displays json and text files in the collection/Files screen
+
Optimizations
----------------------
diff --git a/solr/webapp/web/js/angular/controllers/files.js b/solr/webapp/web/js/angular/controllers/files.js
index 1cb9e5cd55e..00ea4b19ff7 100644
--- a/solr/webapp/web/js/angular/controllers/files.js
+++ b/solr/webapp/web/js/angular/controllers/files.js
@@ -16,7 +16,7 @@
*/
var contentTypeMap = { xml : 'text/xml', html : 'text/html', js : 'text/javascript', json : 'application/json', 'css' : 'text/css' };
-var languages = {js: "javascript", xml:"xml", xsl:"xml", vm: "xml", html: "xml", json: "text", css: "css"};
+var languages = {js: "javascript", xml:"xml", xsl:"xml", vm: "xml", html: "xml", json: "json", css: "css"};
solrAdminApp.controller('FilesController',
function($scope, $rootScope, $routeParams, $location, Files, Constants) {
@@ -82,10 +82,10 @@ solrAdminApp.controller('FilesController',
Files.get({core: $routeParams.core, file: $scope.file, contentType: contentType}, function(data) {
$scope.content = data.data;
$scope.url = $scope.baseurl + data.config.url + "?" + $.param(data.config.params);
- if (contentType.indexOf("text/plain") && data.data.indexOf("<?xml") || data.data.indexOf("<!--")) {
+ if (contentType.indexOf("text/plain") && (data.data.indexOf("<?xml")>=0) || data.data.indexOf("<!--")>=0) {
$scope.lang = "xml";
} else {
- $scope.lang = languages[extension] || "text";
+ $scope.lang = languages[extension] || "txt";
}
});
}
diff --git a/solr/webapp/web/js/angular/services.js b/solr/webapp/web/js/angular/services.js
index f050c9b7253..2413f946836 100644
--- a/solr/webapp/web/js/angular/services.js
+++ b/solr/webapp/web/js/angular/services.js
@@ -207,6 +207,8 @@ solrAdminServices.factory('System',
"list": {},
"get": {method: "GET", interceptor: {
response: function(config) {return config;}
+ }, transformResponse: function(data) {
+ return data;
}}
});
}])