The typical search in neo4j is to write query with restrictions and the node type is an important restriction type. For example:
match (n:Product) where n.name='iPhone' return n
However, if the user doesn't know what node type should be given, he may just write query:
match (n) where n.name='iPhone' return n
And this 'iPhone' may be names of one or another node types, such as Product, or Brand. To make the query more efficient, I may have a function working behind the scene and convert user's keyword search into this query:
match (n)
where (n:Product or n:Brand) and n._name = 'iPhone'
return n
This takes 150 ms shown in the browser, while this one only takes 1 ms:
match (n:Product) where n._name = 'iPhone'
return n
Is there a more efficient way to support users' such queries? Given a keyword without other restrictions, the query return any nodes that may hit this query.