JanusGraph / JanusGraph/janusgraph

Inconsistent + buggy behaviour of textContainsPrefix / Undocumented cases

Open
#4,073 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug/possible
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

This issue is resulting out of the following discussion: https://github.com/JanusGraph/janusgraph/discussions/3942

First, the [documentation](https://docs.janusgraph.org/index-backend/text-search/) for textContainsPrefix is incomplete (more exactly: contradictory) for the case, where the search string contains multiple words / tokens (please have a look at the OP of the discussion for details).
I came up with the following plausible behaviour inferred from the single token case:

"For each token in the query string, at least one token in the text string (read: value of the field which is searched) has to be present, where query token is a prefix of text token"

According to @mad the In-memory implementation org.janusgraph.core.attribute.Text#CONTAINS_PREFIX works as I inferred, but SolrIndex and also LuceneIndex behave differently. Also according to @mad this could be considered a bug. For the LuceneIndex we found the actual behaviour (works just like regular tokenized textContains if query string consists of multiple tokens) and a possible fix to get it working as described above.

If I would be in charge of this, I would first propose to agree on the desired behaviour of textContainsPrefix for the multi token case, where I would actually propose the behaviour above. Then I would consistently implement this across all possible index backends and also very importantly: Add a description of the behavour to the documentation. But, I am not in charge (Spoiler: Probably don't have the time for a PR). So what do you as contributors / maintainers think of how to resolve the issue?

- Version: at least 0.6.3
- Storage Backend: possibly all?
- Mixed Index Backend: at least SolrIndex, LuceneIndex
- Link to discussed bug: https://github.com/JanusGraph/janusgraph/discussions/3942
- Expected Behavior: textContainsPrefix should behave consistently and reasonable if query string contains multiple tokens. Further, that behaviour should be documented.
- Current Behavior: textContainsPrefix behaves differently across backends.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with discussion 3942 and the Text#CONTAINS_PREFIX behavior, then compare the mentioned SolrIndex and LuceneIndex implementations for multi-token queries. The work is complete when the desired semantics are agreed, backends behave consistently, and the text-search documentation describes the multi-token case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, search
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.