Spring Data Neo4j - Combining Fulltext and Simple Indexes in the same Cypher query -
i wonder how can build cypher query combine fulltext , simple indexes using spring data neo4j. consider following node entity:
@nodeentity public class someobject { public someobject() { } public someobject(string name, int height) { this.name = name; this.height = height; } @indexed(indextype = indextype.fulltext, indexname = "search_name") string name; @indexed(numeric = false) int height; public string getname() { return name; } public void setname(string name) { this.name = name; } } ok, question how can run query (by using someobject graph repository) start someobject nodes, referencing simple indexes , full-text indexes in same query. example write that:
start n=node:someobject('name: roy , height: [170 190]') return n i know cannot write that, because spring data neo4j forces me give seperate index name fields needed fulltext indexed. if need make index lookup someobject entity combines both fileds? (name & height)
what best practices in such case? there way combine them both in same query? or maybe should query each of them separably, , perform some kind of intersection between 2 results, nodes meet original query lookup condition? (name: roy , height: [170 190]).
thanks! roy.
i'd never launch 2 separate queries. maybe use 1 index starting point in query?
start n=node:search_name('name: roy') n.height >= 170 , n.height <= 190 return n how's performance of query? bypasses someobject index, don't see other option indeed cannot combine both indexes.
i thinking following query, you'd still end duplicates:
start n=node:search_name('name: roy'), m=node:someobject('height: [170 190]') return distinct n,m
Comments
Post a Comment