Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sorryya opened this issue Nov 17, 2017 · 6 comments
Open

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

sorryya opened this issue Nov 17, 2017 · 6 comments

Comments

@sorryya
Copy link

sorryya commented Nov 17, 2017

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
Copy link
Member

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

@sorryya
Copy link
Author

sorryya commented Nov 17, 2017

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
Copy link
Author

sorryya commented Nov 17, 2017

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

@sorryya
Copy link
Author

sorryya commented Nov 21, 2017

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
Copy link
Member

This was probably the issue is it OK to close?

@sorryya
Copy link
Author

sorryya commented Nov 23, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants