Skip to content

Commit

Permalink
bugfix: re-add support for not text_match (apache#12372)
Browse files Browse the repository at this point in the history
  • Loading branch information
itschrispeck authored Feb 22, 2024
1 parent b7893bd commit 839a91e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public class TextMatchFilterOperator extends BaseFilterOperator {
private final TextMatchPredicate _predicate;

public TextMatchFilterOperator(TextIndexReader textIndexReader, TextMatchPredicate predicate, int numDocs) {
// This filter operator does not support AND/OR/NOT operations.
super(0, false);
super(numDocs, false);
_textIndexReader = textIndexReader;
_predicate = predicate;
_numDocs = numDocs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,24 @@ public void testTextSearchWithAdditionalFilter()
testTextSearchAggregationQueryHelper(query, expected.size());
}

/**
* Test NotFilterOperator with index based doc id iterator (text_match)
* @throws Exception
*/
@Test
public void testTextSearchWithInverse()
throws Exception {

// all skills except the first 28 in createTestData contain 'software engineering' or ('software' and 'engineering')
List<Object[]> expected = new ArrayList<>();
for (int i = 0; i < 28; i++) {
expected.add(new Object[]{1000 + i});
}

String query = "SELECT INT_COL FROM MyTable WHERE NOT TEXT_MATCH(SKILLS_TEXT_COL, 'software') LIMIT 50000";
testTextSearchSelectQueryHelper(query, 28, false, expected);
}

/**
* Test the reference counting mechanism of {@link SearcherManager}
* used by {@link RealtimeLuceneTextIndex}
Expand Down

0 comments on commit 839a91e

Please sign in to comment.