JanusGraph / JanusGraph/janusgraph

Predicate neq() uses tokenized field in case of TEXTSTRING mapping in mixed index

Open
#2,588 0 comments 0 reactions 0 assignees View on GitHub
kind/bug/possible
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

This issue was noted by sergeymetallic@... and further analyzed by hadoopmarc@...

According to the ref docs the eq(), neq(), textPrefix(), textRegex() and textFuzzy() predicates apply to STRING search (so to the non-tokenized field in the index backend). If you instantiate a graph with a mixed index with a TEXTSTRING mapping and add a vertex with a property value "watch the dog", you will find the following inconsistent behaviour:

gremlin> g.V().has('x', neq('watch the dog')).elementMap()
==>[id:4264,label:Some,x:x2,y:??]
==>[id:4224,label:Some,x:x1,y:y1]

gremlin> g.V().has('x', neq('lion')).elementMap()
==>[id:4264,label:Some,x:x2,y:??]
==>[id:4224,label:Some,x:x1,y:y1]
==>[id:4192,label:Some,x:watch the dog]

gremlin> g.V().has('x', neq('watch')).elementMap()
==>[id:4264,label:Some,x:x2,y:??]
==>[id:4224,label:Some,x:x1,y:y1]
**// Here, ==>[id:4192,label:Some,x:watch the dog] is missing, supporting Sergey's issue!!!**

**Observation from sergeymetallic@...:**
Looks like the issue is in this line https://github.com/JanusGraph/janusgraph/blob/master/janusgraph-es/src/main/java/org/janusgraph/diskstorage/es/ElasticSearchIndex.java#L959
Code checks for Cmp.EQUAL but not for Cmp.NOT_EQUAL, so that in case of NOT_EQUAL tokenized field is used

**System details**
- Version: 0.5.3
- Storage Backend: cassandra cql
- Mixed Index Backend: elasticsearch
- Link to discussed bug: [https://lists.lfaidata.foundation/g/janusgraph-users/topic/81963590](https://lists.lfaidata.foundation/g/janusgraph-users/topic/81963590).

Contributor guide

Open the contributing guide

Research direction

Start in janusgraph-es/src/main/java/org/janusgraph/diskstorage/es/ElasticSearchIndex.java at the cited line near 959, then reproduce the Gremlin neq() queries against a TEXTSTRING-mapped mixed index. Compare the behavior for exact, partial, and unrelated values; done means neq() follows the documented non-tokenized STRING semantics consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cassandra, elasticsearch, java
Domain
databases, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.