How to search from Multiple Dictionary keys from list

Hi

I wanted to search from dictionary which is part of COMPANY node . I searched alot for MATCH query but i not found anything

the query i need is getting all nodes having description = "Business services, nec" from industryCodes key

{'industryCodes': [{'code': '561499',
    'description': 'All Other Business Support Services',
    'typeDescription': 'North American Industry Classification System 2022',
    'typeDnBCode': 37788,
    'priority': 1},
   {'code': '73890000',
    'description': 'Business services, nec',
    'typeDescription': 'D&B Standard Industry Code',
    'typeDnBCode': 3599,
    'priority': 1},
   {'code': '7490',
    'description': 'Other professional, scientific and technical activities n.e.c.',
    'typeDescription': 'NACE Revision 2',
    'typeDnBCode': 29104,
    'priority': 1}]}

Node is COMPANY {id = "abc-1" , data = "industyCodeJson"}

Now from above input i need to return COMPANY.id by searching through industryCodes dictionary which present in data property

I am new here and not able to check how to solve this query. Please help

Thanks

You are not able to store json as a property value. You can story it as a string then convert it to map with an apoc procedure.

That being said, I think you should revisit your data mode. Neo4j is not a document database. The industry code data seems like it should be stored as node. This will allow you to find what you want very easily and it will avoid duplicating the industry codes in each company.

With the above data model, you can find all companies that have that specific doe with the following query:

match(n:IndustryCode{description:'Business services, nec'})
match(c:Company)-[:HAS_CODE]->(n)
return c.id
1 Like

Also, the predicate functions are extremely useful when you do want to test each element of a list.

1 Like

Thanks . Now i got some clarity.

1 Like