#### Merged query using logical operator AND returns false results

Dear developers, I re-corrected the syntax and ran new experiments, still triggered the bugs.

### Expected behavior:
We construct the following scenario: we randomly generate two queries Q1, Q2, and merge these two queries using MATCH operator into a new query Q3. See reference at https://stackoverflow.com/questions/48067834/gremlin-intersection-operation. Based on the calculation. The Q3 query result set should be the intersection of result sets from Q1 and Q2.
We generate graph schema and data based on random strings and values. Here is one of our examples that triggered the bug.

1. `g.V().bothE('el1').outV()` returns `[8400]`.
2. `g.V().and(__.outE('el2'))` returns `[16592, 4120, 4136, 4168, 4304]`.
3. `g.V().match(__.as('a').bothE('el1').outV(),__.as('a').filter(and(__.outE('el2')))).select('a')` returns `[16592, 4120, 4168, 4304]`.

We calculate the intersection result set of Q1 and Q2, which is `[]` an empty set.
The intersection result set doesn't equal to Q3 result set.

### Actual behavior:
The intersection result set should equal to Q3 result set. We did trigger some cases conform to this requirement, but still there're some cases that violate this constraint.

### Steps to reproduce:
- Create data
```
Vertex:

Edge:
```

Flash

Hi, give me some time, I'll further check this. Thanks great a lot!

I cannot reproduce the issue you encountered.

```
gremlin> g.V().order().by(desc).order().by(asc).dedup().fold()
==>[v[4128],v[4232],v[4288],v[4304],v[4336],v[8328],v[8384],v[12424],v[12480],v[16576]]
gremlin> g.V().or(__.both('el1')).in('el1').order().by(asc).dedup().fold()
==>[v[4288],v[4336],v[12480],v[16576]]
gremlin> g.V().and(order().by(desc).order().by(asc),or(__.both('el1')).in('el1'))
==>v[8384]
==>v[4128]
==>v[4232]
```
I used the inmemory backend of janusgraph-0.6.2 with graph.set-vertex-id=true in the gremlin console.

Best wishes,    Marc

Flash

We discovered a bug that Merged query using logical operator AND returns false results.

- JanusGraph Version: 0.6.2
- Operating system: macOS 13.2.1
- API/Driver: Java

### Expected behavior:
We construct the following scenario: we randomly generate two queries Q1, Q2, and merge these two queries using AND logical operator into a new query Q3. Based on the AND calculation. The Q3 query result set should be the intersection of result sets from Q1 and Q2.
We generate graph schema and data based on random strings and values. Here is one of our examples that triggered the bug.
1) `g.V().order().by(desc).order().by(asc)` returns `[12424, 12480, 16576, 4128, 4232, 4288, 4304, 4336, 8328, 8384]`
2) `g.V().or(__.both('el1')).in('el1')` returns `[4128, 4128, 4128, 4128, 4232, 4232, 4232, 4232, 8384, 8384, 8384, 8384]`
3) `g.V().and(order().by(desc).order().by(asc),or(__.both('el1')).in('el1'))` returns `[12480, 16576, 4288, 4336]`.

We calculate the intersection result set of Q1 and Q2, which is `[4128, 4232, 8384]`.
The intersection result set doesn't equal to Q3 result set.

### Actual behavior:
The intersection result set should equal to Q3 result set. We did trigger some cases conform to this requirement, but still there're some cases that violate this constraint.

### Steps to reproduce:
We create a graph with 10 nodes and 20 edges. We try to make it clear to reproduce the bugs, **hope** to not cause much inconvenience to your reviewing, but we believe the problem does exist.
Following the following graph data generation query, we can reproduce the bugs:
- Create data
```
Vertex:

Edge: