Saturday 15 March 2014

cypher - neo4j query performance tuning with node(*) -


I've added the nodes with the "nodeetype" property, and want to query only a certain type of node. For example, I have a "site" is a directory that lists the locations around the world. Each place has one: IN_REGION which connects it to a city, and then there is one: IN_REGION in all ways of the country. Therefore:

  site - [: IN_REGION] - & gt; City - [: IN_REGION] - & gt; Province - [: IN_REGION] - & gt; Country   

I am implementing a fuzzy search at locations, and need to search any one from above and return to a string with all the above included. I would like to do this on Neo4j instead of back-end servers, what would be the ideal question to run on? I have the following:

  start location = node (*) WHERE site. Note type! = Match 'match' with venue = 'P = address and lieutenant - [: HAS_ADARDAD] -view- [R1: IN_REGION] - & gt; City - [R2? INSAGION] - & gt; Prov-[r3? INSAGION] - & gt; With Country Location Search for 'name +', '+ address.streetAddress +', '+ city.name +', '+ prov.name +', 'country.name to search =' ". * QUERY_STRING. *" Return to the search limit 30   

Where QUERY_STRING is a fuzzy search string. I'm mostly thinking about node (*) and I'm about to query the end - is it through every single node Is going to comb? In addition, some relationships are optional and empty withdrawal - how do I handle it?

Any help is greatly appreciated!

You are basically asking it to scan whole DB for site nodes (one Good optimization will be an index for node type, or just mamod nodes, and will scan), and then all address / cities / etc of the site, and then compare those addresses with the search string. Your limit is not going to help your performance very much, and it's going to be stinking until you have very small dB. How many places do you have? In any case, you can think of something like this:

  start position = node: place_nex ('name: * QUERY_STRING *') match address & lt; - [: HAS_ADDRESS - places - [: IN_REGION] - & gt; City - [?: IN_REGION] - & gt; Prov - [?: IN_REGION] - & gt; Country Return Locations Name + ',' + address.streetAddress + ',' + city.name + ',' + Faculty (Prof. name, '') + ',' + Colasis (country.name,? ') Start searching city = node: city_index ('name: * QUERY_STRING *') match address & lt; - [: HAS_ADDRESS - location - [: IN_REGION] - & gt; City - [?: IN_REGION] - & gt; Prov - [?: IN_REGION] - & gt; Country Return Locations To know the name as' + ',' + address.streetAddress + ',' + city.name +   

, prov, name, ',' + Colasse (Prof. Names ?, '') + ',' + + Colas (country.name ?, '') Country In 2.0 you can meet these results at once.

No comments:

Post a Comment