I have been using this cypher function to retrieve all indexes from the graph and it has been working all well for a long time.
neo4j_driver = GraphDatabase.driver(self.uri, auth=(self.username, self.password), encrypted=False)
with self.neo4j_driver.session() as session:
all_indexes = set()
indexes = session.read_transaction(
lambda tx:
tx.run("CAll db.indexes"))
for index in indexes:
all_indexes.add(index[1])
This is part of my using the driver code. Today it suddenly stopped working, because the 'indexes' is always empty even though the graph does have a number of indexes created. I didn't do anything about the code or the neo4j Db itself. In figuring out of what might be the cause, I changed the code to the following:
with self.neo4j_driver.session() as session:
all_indexes1 = set()
indexes = session.run("""CAll db.indexes""")
for result in indexes:
all_indexes1.add(result[1])
all_indexes2 = set()
indexes = session.read_transaction(
lambda tx:
tx.run("CAll db.indexes"))
for index in indexes:
all_indexes2.add(index[1])
print(len(all_indexes1), len(all_indexes2))
It turns out that all_indexes1 is not empty as expected, but all_indexes2 is empty, which is puzzling. What could cause this? I don't think I changed anything to cause this.