Created
September 18, 2012 15:35
-
-
Save Iknewthisguy/3743800 to your computer and use it in GitHub Desktop.
Filter in Cypher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def match | |
criteria_matched = params[:quantity] | |
case criteria_matched | |
when criteria_matched == 4 | |
results = Neo4j._query("START n=node(13626) MATCH(n)-[:_all]->(x) WHERE x.city == #{Resume.city} AND x.school == #{Resume.school} AND x.sport == #{Resume.sport} AND x.skill =~ /(?i-mx:.*#{Resume.skill}.*)/ RETURN x") | |
when criteria_matched == 5 | |
results = Neo4j._query("START n=node(13626) MATCH(n)-[:_all]->(x) WHERE x.city == #{Resume.city} AND x.school == #{Resume.school} AND x.sport == #{Resume.sport} AND x.skill =~ /(?i-mx:.*#{Resume.skill}.*)/ AND x.history == #{Resume.history} RETURN x") | |
when criteria_matched == 6 | |
results = Neo4j._query("START n=node(13626) MATCH(n)-[:_all]->(x) WHERE x.city == #{Resume.city} AND x.school == #{Resume.school} AND x.sport == #{Resume.sport} AND x.skill =~ /(?i-mx:.*#{Resume.skill}.*)/ AND x.history == #{Resume.history} AND x.pets == #{Resume.pets} RETURN x") | |
when criteria_matched == 7 | |
results = Neo4j._query("START n=node(13626) MATCH(n)-[:_all]->(x) WHERE x.city == #{Resume.city} AND x.school == #{Resume.school} AND x.sport == #{Resume.sport} AND x.skill =~ /(?i-mx:.*#{Resume.skill}.*)/ AND x.history == #{Resume.history} AND x.pets == #{Resume.pets} AND x.mom == #{Resume.mom} RETURN x") | |
end | |
return results | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment