简体   繁体   中英

Cypher query freezes on specific node

I am running this query:

MATCH (n1:Word{word: '"+word1+"'})-[r*]-(n2:Word) 
WHERE (n2.word <> n1.word) AND (n2.pos CONTAINS 'NN') 
RETURN DISTINCT(n2)

for different values of word1 and it runs perfectly for dozens of words, but when it comes to the word 'method' the server just doesn't responds. I've checked all the nodes with this value on the property.word and nothing seems to be different than other nodes.

Any help is welcome. Thanks

I've realized that in the specific case of this word there was a loop that fitted the query and because of [r*] was allowing the query to search for paths of infinite length, result: deadlock .

By fixing a max path size (eg [r*0..10] ) my problem was solved.

Hope this helps other users (:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM