0
考慮以下類:查詢上數組屬性或嵌入屬性
class Basic{
String id;
Double val;
//some other member variables
}
class NodeBO{
List<String> id;
Type type;
// list of id from objects of Basic class in data below
Map<ChEnum, Basic> data;
addBeans(NodeBO nodeBO, Node node){
// in transaction...
node.setProperty("priperties", nodeBO.toString());
// is it ok to convert to array? or should be converted to JSON string?
node.setProperty(GraphElementProps.id,toArray(nodeBO.id));
node.setProperty(GraphElementProps.type, nodeBO.type);
}
@override
toString(){
//return json of this object
}
}
enum ChEnum{
CH1(1), CH2(2);
// constructor and some methods
}
節點使用autoIndexer索引:
AutoIndexer<Node> nodeAutoIndexer = GRAPH_DB.index().getNodeAutoIndexer();
nodeAutoIndexer.startAutoIndexingProperty(GraphElementProps.id);
nodeAutoIndexer.setEnabled(true);
GRAPH_NODE_AUTO_INDEX = nodeAutoIndexer.getAutoIndex();
這裏我存儲GraphElementProps.id
作爲節點屬性(由轉換爲數組)。它是否將數組(字符串)作爲屬性?或者我應該將列表轉換爲JSON字符串,然後存儲?
我希望能夠在queryId
給出的陣列上查詢。例如查詢節點索引以獲得node.getProperty(GraphElementProps.id)
包含的節點queryId
?即是這樣的:
// how to do this?
GRAPH_NODE_AUTO_INDEX.get(/*Nodes whose id contain queryId*/);
或者是它(在某種程度上)可能使Basic
類id
財產可轉位和可搜索?如果可能,如何索引這些屬性?以及如何查詢它們?
我無法理解,但它是否與Spring-data-neo4j
有關?我對Spring-data-neo4j
完全陌生。