Comments (3)
Attached a proposed rewrite of the function in which type is preserved as a metadata property, and values are pushed into a values array property:
// Rewrite the data.results part of the response from /v1/search so that the metadata section in each is easier
// to work with.
function rewriteResults(results) {
var rewritten = [];
var revised = {};
var metadata;
angular.forEach(results, function(result, i) {
revised = {};
angular.forEach(result, function(property, prop) {
if (prop === 'metadata') {
metadata = {};
angular.forEach(property, function(field, j) {
angular.forEach(field, function(value, key) {
if (key !== 'metadata-type') {
if (metadata[key] === undefined) {
metadata[key] = { name: key, 'metadata-type': field['metadata-type'] };
}
if (metadata[key].values) {
metadata[key].values.push(value);
} else {
metadata[key].values = [ value ];
}
}
});
});
revised.metadata = metadata;
} else {
revised[prop] = result[prop];
}
});
rewritten.push(revised);
});
return rewritten;
}
from slush-marklogic-node.
fixed in #49
from slush-marklogic-node.
Superseded by ml-search-ng in which this has been fixed.
from slush-marklogic-node.
Related Issues (20)
- MessageBoard not cleared when navigating away
- Document how to deploy packages (modules) added by mlpm
- PhantomJS SyntaxError: Use of const in strict mode. HOT 1
- Stack overflow in indent.xsl
- Every reload of the '/search' requires the user to log-in again HOT 2
- SyntaxError: Use of const in strict mode. HOT 4
- Clicking search results fails to open them HOT 1
- Raw JSON preview broken
- fix npm warnings HOT 2
- Splitting facets and results back-end calls HOT 1
- Improve chart features HOT 4
- Add out of the box i18n support HOT 1
- Slush generator hanging HOT 3
- Investigate replacing Roxy with ml-app-deployer CLI
- Documentation: Extracting element values from XML
- Opening / rendering big documents on the detail page takes forever HOT 1
- Make easy to use web components from bower
- White on White icons in Column Slush Generated Code
- Facet suggestion field
- Slush middle-tier auth fails against 9.0-6.2+
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slush-marklogic-node.