所以我的问题基本上和这里描述的一样,但是对于小组来说仍然没有答案.
我的映射:
{
"abstract": {
"properties": {
"summary": {
"type": "string"
}
}
},
"authors": {
"type": "nested",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想对这两个领域进行全文搜索,可能是不平等的加权.我想到的查询,但不幸的是不起作用,将是这样的:
{
"query": {
"bool": {
"should": [{
"multi_match": {
"query": "higgs boson",
"fields": ["abstract.summary^5", "author.last_name^2"]
}
}]
}
}
}
Run Code Online (Sandbox Code Playgroud)
我没有得到authors字段的任何结果,因为它的嵌套映射.我也无法摆脱嵌套属性 - 我将它用于聚合.任何优雅的想法如何解决?
我有一个部署到 WildFly 8.1.0-Final 的 Java EE 7 项目。我使用由 Maven 管理的独立 Wildfly 服务器(即每个 上的干净配置mvn clean)进行测试,并远程使用“普通”服务器。
为了使用 maven-wildfly-plugin (1.0.2.Final) 部署到两台服务器,我配置了两个 Maven 配置文件:wildfly-local,它定义了本地用户名、密码和端口号;和wildfly-remote,它定义了远程用户名、密码和端口号。
但是,远程服务器以域模式运行,而本地服务器则不然。因此,我需要为远程服务器定义一个带有服务器组的域配置,如下所示:
...
<plugin>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<hostname>${wildfly-hostname}</hostname>
<username>${wildfly-username}</username>
<password>${wildfly-password}</password>
<domain>
<server-groups>
<server-group>${wildfly-server-group}</server-group>
</server-groups>
</domain>
</configuration>
...
</plugin>
...
Run Code Online (Sandbox Code Playgroud)
${wildfly-hostname}并且在配置文件中定义了其他三个属性,并且此配置有效。但是,独立的非“域模式”本地测试服务器根本不允许部署定义了服务器组的应用程序。
我的第一个想法是在远程配置文件中定义一个嵌套属性,如下所示:
<profile>
<id>wildfly-remote</id>
<properties>
...
<wildfly-domain>
<server-groups>
<server-group>*my server group name*</server-group>
</server-groups>
</wildfly-domain>
...
</properties>
</profile>
Run Code Online (Sandbox Code Playgroud)
...以及本地配置文件中的一个简单属性,如下所示:
<profile>
<id>wildfly-local</id>
<properties>
<wildfly-domain/>
</properties>
</profile>
Run Code Online (Sandbox Code Playgroud)
Maven 不喜欢这样,因为它无法解析需要文本的标签。
有什么方法可以定义嵌套在一个 Maven 配置文件中但平放在另一个配置文件中的“资源”?
我使用forEach,Java 8创建了这个问题 流创建列表列表(嵌套列表)
class EntityCompositeId {
private Long firstId;
private Long secondId;
// getter & setter...
}
class EntityComposite {
private EntityCompositeId id;
private String first;
private String second;
// getter & setter...
}
List<EntityComposite> listEntityComposite = ....
Supose this content
1, 1, "firstA", "secondBirdOne"
1, 2, "firstA", "secondBirdTwo"
1, 3, "firstA", "secondBirdThree"
2, 1, "firstB", "secondCatOne"
2, 2, "firstB", "secondCatTwo"
2, 3, "firstB", "secondCatThree"
3, 1, "firstC", "secondDogOne"
3, 2, "firstC", "secondDogTwo"
3, 3, "firstC", "secondDogThree"
Map<Long, …Run Code Online (Sandbox Code Playgroud) 我最近偶然发现一个问题,WPFListView控件似乎限制了对其项目进行排序的能力。SortDescription具体来说,我在尝试识别嵌套属性(属性的属性)时遇到了很大的麻烦。
对于按属性直接排序,以下行应该完成这项工作:
listView.Items.SortDescriptions.Add(new SortDescription("MyProperty",
ListSortDirection.Ascending));
Run Code Online (Sandbox Code Playgroud)
事实上,它对我来说效果很好。但是,因为ItemSourcefor myListView是 (强类型) DataTable,所以某些列绑定到行的嵌套属性(即Row.OtherTableRow.SubProperty绑定路径样式) - 这是 ADO.NET 数据集用于分层数据库的方式。
我想做的是这样的:
listView.Items.SortDescriptions.Add(new SortDescription("MyProperty.SubProperty",
ListSortDirection.Ascending));
Run Code Online (Sandbox Code Playgroud)
但不幸的是,该行抛出一个ArgumentException:
“Orders”类型没有名为“Row.[ID]”的属性,因此无法对数据集合进行排序。
奇怪的是,我在绑定嵌套属性时没有任何问题。事实上,这些字段在...中显示得很好......ListView添加 a 也不PropertyGroupDescription会给listView.GroupDescriptions我带来嵌套属性的任何问题 - 它只是SortDescriptions!
这只是 WPF/控件的限制吗ListView?作为框架的一部分,我有什么办法可以获得支持,或者我会运气不佳吗?如果不幸的是,并且这种不一致是不可避免的,如果有人能为这种嵌套属性的场景建议一种破解或解决方法,我将非常感激。我已经尝试过一些想法,但都收效甚微。
注意:我意识到 ORM 可以很好地解决我的问题,但恐怕这对于我当前正在从事的项目来说根本不可行。简单的 ADO.NET 数据集就可以了。
java ×2
java-8 ×1
java-stream ×1
listview ×1
match ×1
maven ×1
nested ×1
nested-map ×1
properties ×1
sorting ×1
wpf ×1