select("anything").count() always returns 1 when called inside choose()
Why this happens? Is there any elegant and not slow to execute workaround for this problem? With "elegant and not slow" I mean a solution where I don't have to write the search 2 times because I cannot use select() to go back.
You can test by yourself this on the gremlin console with these lines:
g.addV("test1")
g.addV("test2")
g.addV("test3")
count works because not using select:
g.V().as("result").choose(V().count().is(gt(1)), constant("greater than 1"), constant("not greater than 1"))
count not working because the elements being counted comes from select:
g.V().as("result").choose(select("result").count().is(gt(1)), constant("greater than 1"), constant("not greater than 1"))