Hi Robert,
Yes, all my properties Inc NodeProperties are stringified object. To be specific, its byte encoded strings. I do this to take care of special characters while pushing. I don't think that should be an issue, as I want to do a partial search on the property, and that is reason why I used textContains() on property node_id.
Please note some extra specifics for problem:
I use Python as client, and push data using GLV.
My workflow to push data and where searching fails on node_id is as follows:
search_case_query = "g.V().has('NodeProperties', Text.textContains('5401')).count()"
num_nodes = dbCON.query(search_case_query)
if len(num_nodes) > 0:
drop_query = "g.V().has('NodeProperties', Text.textContains('5401')).drop().iterate(); graph.tx().commit()"
dbCON.query(drop_query)
else:
print("Not present. Going to add!")
query = self.build_node_addition_query(node)
addedNode = dbCON.query(query)
sourceGraphNode = dbCON.query("g.V().has('node_id', "
"textContains('{}')).id()".format(source_id))
targetGraphNode = dbCON.query(
"g.V().has('node_id', textContains('{}')).id()".format(
target_id))
edge = source_node.addE(category).to(target_node).id().next()
The above step is where it fails. Logically, I added node in previous step, and searching for that node based on node_id. and adding a edge based on its instance.
Note that my dbCon is custom class which used Goblin to query into Janus directly. The query method for dbCon is as follows:
if loop is None:
try:
loop = asyncio.get_event_loop()
except RuntimeError:
logger.debug("Couldn't get event loop for current thread. Creating a new event loop to be used!")
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
response = self.__run(loop, query)
if loop is None:
loop.close()
return response
def __run(self, loop, query):
messages = []
async def run(loop, query):
cluster = await Cluster.open(loop)
client = await cluster.connect()
resp = await client.submit(query)
async for msg in resp:
messages.append(msg)
await cluster.close()
loop.run_until_complete(run(loop, query))
return messages
Please let me know if you can still reproduce this error or not.
If not, also let me know is this proper way to create Index? Steps i sequential format:
1: Use gremlin shell to drop nodes.
2: Create Index on Graph without any nodes in it.
3: Start pushing data.
4: Expect Index to by created for newly pushed vertecis once its pushed.
Thanks