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*/);

还是(以某种方式)可以使类id的属性Basic可索引和可​​搜索?如果可能,如何索引这些属性?以及如何查询它们?

我无法理解,但这与它有关Spring-data-neo4j吗?我对Spring-data-neo4j.

4

1 回答 1

0

我认为最好的解决方案是使用Spring-data-neo4j。这将允许索引嵌入字段并对其进行查询。

于 2013-07-11T12:29:48.377 回答