本文整理了Java中org.vertexium.query.Query.sort
方法的一些代码示例,展示了Query.sort
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.sort
方法的具体详情如下:
包路径:org.vertexium.query.Query
类名称:Query
方法名:sort
[英]Sort the results by the given property name.
[中]按给定的属性名称对结果进行排序。
代码示例来源:origin: org.visallo/visallo-core
protected void applySortToQuery(QueryAndData queryAndData, SearchOptions searchOptions) {
String[] sorts = searchOptions.getOptionalParameter("sort[]", String[].class);
if (sorts == null) {
JSONArray sortsJson = searchOptions.getOptionalParameter("sort", JSONArray.class);
if (sortsJson != null) {
sorts = JSONUtil.toStringList(sortsJson).toArray(new String[sortsJson.length()]);
}
}
if (sorts == null) {
return;
}
for (String sort : sorts) {
String propertyName = sort;
SortDirection direction = SortDirection.ASCENDING;
if (propertyName.toUpperCase().endsWith(":ASCENDING")) {
direction = SortDirection.ASCENDING;
propertyName = propertyName.substring(0, propertyName.length() - ":ASCENDING".length());
} else if (propertyName.toUpperCase().endsWith(":DESCENDING")) {
direction = SortDirection.DESCENDING;
propertyName = propertyName.substring(0, propertyName.length() - ":DESCENDING".length());
}
queryAndData.getQuery().sort(propertyName, direction);
}
}
代码示例来源:origin: visallo/vertexium
v1.query(AUTHORIZATIONS_A)
.sort(ExtendedDataRow.TABLE_NAME, SortDirection.ASCENDING)
.sort(ExtendedDataRow.ROW_ID, SortDirection.ASCENDING)
.extendedDataRows()
);
graph.query(AUTHORIZATIONS_A)
.sort(ExtendedDataRow.ELEMENT_ID, SortDirection.ASCENDING)
.sort(ExtendedDataRow.ROW_ID, SortDirection.ASCENDING)
.extendedDataRows()
);
graph.query(AUTHORIZATIONS_A)
.sort(ExtendedDataRow.ELEMENT_TYPE, SortDirection.ASCENDING)
.sort(ExtendedDataRow.ROW_ID, SortDirection.ASCENDING)
.extendedDataRows()
);
代码示例来源:origin: org.vertexium/vertexium-test
assertEquals("v2", results.iterator().next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("prop3").sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING).elements();
assertEquals(2, count(results));
Iterator<Element> iterator = results.iterator();
代码示例来源:origin: org.vertexium/vertexium-test
v1.query(AUTHORIZATIONS_A)
.sort(ExtendedDataRow.TABLE_NAME, SortDirection.ASCENDING)
.sort(ExtendedDataRow.ROW_ID, SortDirection.ASCENDING)
.extendedDataRows()
);
graph.query(AUTHORIZATIONS_A)
.sort(ExtendedDataRow.ELEMENT_ID, SortDirection.ASCENDING)
.sort(ExtendedDataRow.ROW_ID, SortDirection.ASCENDING)
.extendedDataRows()
);
graph.query(AUTHORIZATIONS_A)
.sort(ExtendedDataRow.ELEMENT_TYPE, SortDirection.ASCENDING)
.sort(ExtendedDataRow.ROW_ID, SortDirection.ASCENDING)
.extendedDataRows()
);
代码示例来源:origin: org.vertexium/vertexium-test
.sort(agePropertyName, SortDirection.ASCENDING)
.vertices());
assertVertexIds(vertices, "v2", "v1", "v3", "v4");
.sort(agePropertyName, SortDirection.DESCENDING)
.vertices());
assertVertexIds(vertices, "v2", "v1", "v4", "v3");
.sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING)
.edges());
assertEdgeIds(edges, "e1", "e2", "e3");
.sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING)
.edges());
assertEdgeIds(edges, "e1", "e2", "e3");
代码示例来源:origin: visallo/vertexium
.sort(agePropertyName, SortDirection.ASCENDING)
.vertices());
assertVertexIds(vertices, "v2", "v1", "v3", "v4");
.sort(agePropertyName, SortDirection.DESCENDING)
.vertices());
assertVertexIds(vertices, "v2", "v1", "v4", "v3");
.sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING)
.edges());
assertEdgeIds(edges, "e1", "e2", "e3");
.sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING)
.edges());
assertEdgeIds(edges, "e1", "e2", "e3");
代码示例来源:origin: visallo/vertexium
assertEquals("v2", results.iterator().next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("prop3").sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING).elements();
assertEquals(2, count(results));
Iterator<Element> iterator = results.iterator();
代码示例来源:origin: org.vertexium/vertexium-test
.sort(dateColumnName, SortDirection.ASCENDING)
.vertices();
assertEquals(0, queryResults.getTotalHits());
.sort(dateColumnName, SortDirection.ASCENDING)
.search();
assertEquals(1, searchResults.getTotalHits());
代码示例来源:origin: visallo/vertexium
.sort(dateColumnName, SortDirection.ASCENDING)
.vertices();
assertEquals(0, queryResults.getTotalHits());
.sort(dateColumnName, SortDirection.ASCENDING)
.search();
assertEquals(1, searchResults.getTotalHits());
内容来源于网络,如有侵权,请联系作者删除!