我有一个用例,其中我想根据特定条件在单独的索引中索引我的文档.例如,我想将发票文档存储到部门名称后缀的索引.
@Document(indexName="store_{department}", indexStoreType="invoice")
public class InvoiceES{
// fields
@Id
private String id;
@Field
private String department;
}
Run Code Online (Sandbox Code Playgroud)
是否可以使用Spring Data实现这一目标?
如果没有,是否计划在即将发布的Spring Data版本中?
我是MongoDB的新手.我正在准备一个学习的例子.看起来当使用与Spring Data和DBRef的双向关系时,它会进入无尾循环并不断地一次又一次地读取关联.
域类看起来像
class Category{
private String name;
private Category parentCategory;
private Set<Category> childCategories;
// getter & setters
}
Run Code Online (Sandbox Code Playgroud)
我想知道这种双向关系是否是罕见的情况(虽然在ORM中非常普遍),却无法得到任何帮助.一种选择可能是编写自定义转换器并忽略关系的任何一方,但这会将我的内存中对象变为不一致状态.
请分享有关处理此类方案的这方面或一些最佳做法的想法.
谢谢,Vishal Shukla
我正在使用NVD3 -angularjs-nvd3-directives的AngularJS包装器.
我设法改变了图表中的颜色,但颜色没有反映在图例中.
这是小提琴 http://jsfiddle.net/vishal1shukla2/NChH9/1/
<div ng-app='nvd3TestApp'>
<div ng-controller="ExampleCtrl">
<nvd3-pie-chart
data="exampleData"
id="exampleId"
showLabels="true"
x="xFunction()"
y="yFunction()"
donut="true"
donutRatio="0.3"
donutLabelsOutside="false" width="400" height="400" color="colorFunction()" showLegend="true" >
<svg width="600"></svg>
<svg height="600"></svg>
</nvd3-pie-chart>
</div>
</div>
var app = angular.module("nvd3TestApp", ['nvd3ChartDirectives']);
function ExampleCtrl($scope){
$scope.exampleData = [
{
key: "On Hold",
y: 5
},
{
key: "Open",
y: 2
},
{
key: "Closed",
y: 9
}
];
var colorArray = ['#FF0000', '#0000FF', '#FFFF00', '#00FFFF'];
$scope.colorFunction = function() {
return function(d, i) {
return colorArray[i];
};
}
$scope.xFunction …Run Code Online (Sandbox Code Playgroud)