apache / apache/lucene

RegexpQueryNode inconsistent treatment of begin and end parameters [LUCENE-6498]

Open
#7,557 0 comments 0 reactions 0 assignees View on GitHub
affects-version:4.10.4 legacy-jira-priority:Major module:queryparser type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

RegexpQueryNode has some questionable treatment of the begin and end parameters:

```Java
public RegexpQueryNode(CharSequence field, CharSequence text, int begin,
int end) {
this.field = field;
this.text = text.subSequence(begin, end);
}
```

when contrasted with FieldQueryNode:

```Java
public FieldQueryNode(CharSequence field, CharSequence text, int begin,
int end) {
this.field = field;
this.text = text;
this.begin = begin;
this.end = end;
this.setLeaf(true);
}
```

I am now not entirely sure which of the two is correct...

---
Migrated from [LUCENE-6498](https://issues.apache.org/jira/browse/LUCENE-6498) by Trejkaz

Contributor guide

Open the contributing guide

Research direction

Start by comparing the RegexpQueryNode and FieldQueryNode constructors shown in the issue, then inspect how their begin and end parameters are used elsewhere. Determine the intended parameter semantics and verify the behavior with the relevant query-node tests, if present; the issue is done when the treatment is resolved consistently and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.