Skip to content

Commit

Permalink
Support unordered non-overlapping intervals (#2103)
Browse files Browse the repository at this point in the history
* Support unordered non-overlapping intervals

This commit exposes Intervals.unorderedNoOverlaps (LUCENE-8828).

Signed-off-by: Matt Weber <[email protected]>

* Replace ordered and overlap flags with enum.

- add IntervalMode enum
- deprecate ordered
- bwc between IntervalMode and ordered flag
- update tests
- update rest tests

Signed-off-by: Matt Weber <[email protected]>

* fix annotated text plugin test

Signed-off-by: Matt Weber <[email protected]>

* bwc to 2x only

Signed-off-by: Matt Weber <[email protected]>

* BWC rest tests for ordered flag

Signed-off-by: Matt Weber <[email protected]>
  • Loading branch information
mattweber authored Feb 17, 2022
1 parent b9ff91d commit cfd96e3
Show file tree
Hide file tree
Showing 11 changed files with 654 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.opensearch.index.mapper.FieldTypeTestCase;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.mapper.Mapper;
import org.opensearch.index.query.IntervalMode;

import java.io.IOException;
import java.util.Collections;
Expand All @@ -51,7 +52,7 @@ public class AnnotatedTextFieldTypeTests extends FieldTypeTestCase {
public void testIntervals() throws IOException {
MappedFieldType ft = new AnnotatedTextFieldMapper.AnnotatedTextFieldType("field", Collections.emptyMap());
NamedAnalyzer a = new NamedAnalyzer("name", AnalyzerScope.INDEX, new StandardAnalyzer());
IntervalsSource source = ft.intervals("Donald Trump", 0, true, a, false);
IntervalsSource source = ft.intervals("Donald Trump", 0, IntervalMode.ORDERED, a, false);
assertEquals(Intervals.phrase(Intervals.term("donald"), Intervals.term("trump")), source);
}

Expand Down
Loading

0 comments on commit cfd96e3

Please sign in to comment.