unipop icon indicating copy to clipboard operation
unipop copied to clipboard

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

Open sorryya opened this issue 7 years ago • 6 comments

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()

sorryya avatar Nov 17 '17 08:11 sorryya

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

seanbarzilay avatar Nov 17 '17 09:11 seanbarzilay

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 avatar Nov 17 '17 09:11 sorryya

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

sorryya avatar Nov 17 '17 09:11 sorryya

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.

sorryya avatar Nov 21 '17 01:11 sorryya

This was probably the issue is it OK to close?

seanbarzilay avatar Nov 22 '17 16:11 seanbarzilay

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

sorryya avatar Nov 23 '17 00:11 sorryya