예제 #1
0
        public override void CreateIndexOnProperty(string propertykey, string label)
        {
            logger.Info(label);
            label = "V";
            List <string> set = GremlinClient.GetArray <string>(new GremlinScript("graph.getVertexIndexedKeys(\"" + label + "\")"));

            if (set == null)
            {
                GremlinClient.Execute(new GremlinScript("def config = new BaseConfiguration(); graph.prepareIndexConfiguration(config); graph.createVertexIndex(\"" + propertykey + "\", \"" + label + "\", config)"));
                logger.Info("Create index on Property: prop: " + propertykey + " label: " + label);
            }
            if (set.Contains(propertykey))
            {
                logger.Info("Tryed to create index on Property: prop: " + propertykey + " label: " + label);
            }
            else
            {
                GremlinClient.Execute(new GremlinScript("def config = new BaseConfiguration(); graph.prepareIndexConfiguration(config); graph.createVertexIndex(\"" + propertykey + "\", \"" + label + "\", config)"));
                logger.Info("Create index on Property: prop: " + propertykey + " label: " + label);
            }
        }