neo4j - reusing indexes that have already been created -


i using neo4j java servlet. have code initializes database, creates indexes, , declares uniquenodefactories.

when restart servlet, how check whether index has been created , reference if has? how do same thing uniquenodefactories?

to reference index, can use:

indexmanager index = graphdb.index(); index<node> actors = index.fornodes( "actors" ); 

fornodes create index if not exist.

instead, if want check existence of index, can use:

index.existsfornodes( "actors" ); 

i believe same applies uniquenodefactory (it returned or created if not exist):

uniquefactory<node> factory = new uniquefactory.uniquenodefactory( graphdb, "actors" ) 

Comments