Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Aug 5, 2024
1 parent c617db8 commit c3fb215
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,20 @@ public void testTermsQuery() {
new TermInSetQuery("field", terms),
new TermInSetQuery(MultiTermQuery.DOC_VALUES_REWRITE, "field", terms)
);
assertEquals(expected, ft.termsQuery(Arrays.asList("foo", "bar"), null, RewriteOverride.DEFAULT));
assertEquals(expected, ft.termsQuery(Arrays.asList("foo", "bar"), RewriteOverride.DEFAULT, null));

MappedFieldType onlyIndexed = new KeywordFieldType("field", true, false, Collections.emptyMap());
Query expectedIndex = new TermInSetQuery("field", terms);
assertEquals(expectedIndex, onlyIndexed.termsQuery(Arrays.asList("foo", "bar"), null, RewriteOverride.DEFAULT));
assertEquals(expectedIndex, onlyIndexed.termsQuery(Arrays.asList("foo", "bar"), RewriteOverride.DEFAULT, null));

MappedFieldType onlyDocValues = new KeywordFieldType("field", false, true, Collections.emptyMap());
Query expectedDocValues = new TermInSetQuery(MultiTermQuery.DOC_VALUES_REWRITE, "field", terms);
assertEquals(expectedDocValues, onlyDocValues.termsQuery(Arrays.asList("foo", "bar"), null, RewriteOverride.DEFAULT));
assertEquals(expectedDocValues, onlyDocValues.termsQuery(Arrays.asList("foo", "bar"), RewriteOverride.DEFAULT, null));

MappedFieldType unsearchable = new KeywordFieldType("field", false, false, Collections.emptyMap());
IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> unsearchable.termsQuery(Arrays.asList("foo", "bar"), null, RewriteOverride.DEFAULT)
() -> unsearchable.termsQuery(Arrays.asList("foo", "bar"),RewriteOverride.DEFAULT,null)
);
assertEquals(
"Cannot search on field [field] since it is both not indexed, and does not have doc_values " + "enabled.",
Expand Down

0 comments on commit c3fb215

Please sign in to comment.