Search code examples
neo4jneo4jclient

Different result set between Neo4j Desktop and Enterprise


I've run into a weird issue. I initially developed the database and API using the Desktop edition and a .Net Core Web API. I wrote a search query to find nodes based on a mutual relationship:

var results = _client.Cypher
.Match("(n:Person {userId: {userId}})-[]->(ct:ConnectionType)<-[]-(other:Person)")
.Where("ct.key IN {ctQuery}")
.WithParams(new
{
    searchDto.userId,
    ctQuery = searchDto.connectionType
})
.ReturnDistinct((other) => new
{
    Profile = other.As<SearchResultsDto>()
}).Results;

While working locally, everything worked fine. However, when I transferred the API and database up to a linux server, an empty result was returned.

The issue seems to be related to the datatypes that I'm using. The "key" property of the connected node is an integer. The ctQuery object is an int[]. When on the Desktop, everything worked fine. I opened up the browser and used the same query and still got no results when connected to the Enterprise Server. When connected to the Desktop database, I got results.

I was able to get results if I changed the int[] to a string[].

Is there a setting within the Enterprise that prevents int arrays from being queried? If so, can it be changed? I have a lot of queries that will be using the key and I would rather not constantly be converting the strings to ints and back again.


Solution

  • There is no setting as you described.

    You might have missed conversion of string to integer while loading data in Enterprise Server.

    You can run a query to convert all the String values for ConnectionType keys into Integer.

    MATCH (n:ConnectionType)
    SET n.key= toInt(n.key)