unipop-graph / unipop

Data Integration Graph
Apache License 2.0
203 stars 35 forks source link

g.V().hasLabel("USER").limit(2).id().toList() can't work #116

Open sorryya opened 6 years ago

sorryya commented 6 years ago

fragment of the mapping file:

"vertices": [
    {
      "index": "*",
      "id": "@user",
      "label": "USER",
      "properties": {
        "user": "@user"
      }
    },

code:

            System.out.println(g.V().hasLabel("USER").id().limit(2).toList());
            System.out.println(g.V().hasLabel("USER").limit(2).id().toList());
            System.out.println(g.V().has("user").id().limit(2).toList());
            System.out.println(g.V().has("user").limit(2).id().toList());
            System.out.println(g.V().hasLabel("USER").valueMap().limit(2).toList());
            System.out.println(g.V().hasLabel("USER").limit(2).valueMap().toList());
            System.out.println(g.V().has("user").valueMap().limit(2).toList());
            System.out.println(g.V().has("user").limit(2).valueMap().toList());

output:

[Tom, Rose]
[]
[Tom, Rose]
[Tom, Rose]
[{user=[Tom]}, {user=[Rose]}]
[]
[{user=[Tom]}, {user=[Rose]}]
[{user=[Tom]}, {user=[Rose]}]

Problem: Why are these two queries that don't work?

g.V().hasLabel("USER").limit(2).id().toList()
g.V().hasLabel("USER").limit(2).valueMap().toList()
seanbarzilay commented 6 years ago

Both queries work for me using your mapping can you provide me with sample data from your es cluster?

sorryya commented 6 years ago

And these:

System.out.println(g.V().hasLabel("USER").toList()); // ok
System.out.println(g.V().hasLabel("USER").limit(2).toList());  // got nothing
System.out.println(g.V("小明").valueMap().toList()); // got nothing
System.out.println(g.V("Tom").valueMap().toList()); // ok
sorryya commented 6 years ago

The special thing of my data is: some user named in chinese.

sorryya commented 6 years ago

Maybe it's because the field "USER" has been analyzed into tokens. We found that if a string field is setted with "not_analyzed", the queries are right.

seanbarzilay commented 6 years ago

This was probably the issue is it OK to close?

sorryya commented 6 years ago

I think this is a bug that needs fixing. It should support the analyzed fields.