我正在使用Solr数据导入器导入一些类别数据。我不想在父查询中使用左连接,因为它太复杂了,我更喜欢在配置中使用嵌套对象查询来保持简单。
我有一个类别//My Services
as.service('songGenreService', function () {
var genreList = [];
var addGenres = function (newObj) {
genreList = newObj;
};
var getGenres = function () {
return genreList;
};
return {
addGenres: addGenres,
getGenres: getGenres
};
});
as.controller('SongListController', ['$scope', 'Song', "$stateParams", 'Category', 'Album', 'base64', 'langConversion', 'CONFIG', 'Poet', "songGenreService",
function ($scope, Song, $stateParams, Category, Album, base64, langConversion, CONFIG, Poet, songGenreService) {
$scope.getCategories = function () {
Category.find({
filter: {
fields: ["id", "name"],
where: {
parentId: 2
}
}
}).$promise.then(function (categories) {
$scope.categories = categories;// Here I am giving data to other source.
songGenreService.addGenres(categories);
$scope.genreId = $scope.categories[0].id;
$scope.genreName = $scope.categories[0].name;
});
}();
}
]);
as.controller('SongGenreController', ['$scope', 'Song', "songGenreService",
function ($scope, Song, songGenreService) {
$scope.categories = songGenreService.getGenres();
console.log($scope.categories);
}
]);
的一对一关系。我的问题是,当mediaItemX_id字段中的值为空时,如何处理它?我已尝试过下面的嵌套配置,但是当值为null时,它报告无效的sql,因为嵌套查询不打印feature images
- 它打印空白....
null
答案 0 :(得分:0)
Solr支持$ {value:default}这个概念作为其他地方的替代品,所以我至少会尝试这样做:
${category.mediaItem1_id} IS NOT NULL AND id = ${category.mediaItem1_id:0}
如果当前值为false,我无法找到跳过实体整体的好方法。