Skip to content

Commit

Permalink
Fixing boolean field 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 Mar 20, 2024
1 parent ead6713 commit f942eaa
Showing 1 changed file with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@

package org.opensearch.index.mapper;

import org.apache.lucene.document.SortedNumericDocValuesField;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.IndexOrDocValuesQuery;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.BytesRef;
import org.opensearch.common.xcontent.XContentFactory;
Expand Down Expand Up @@ -208,13 +206,7 @@ public void testBoosts() throws Exception {
}));

MappedFieldType ft = mapperService.fieldType("field");
assertEquals(
new IndexOrDocValuesQuery(
new BoostQuery(new TermQuery(new Term("field", "T")), 2.0f),
SortedNumericDocValuesField.newSlowExactQuery("field", 1)
),
ft.termQuery("true", null)
);
assertEquals(new BoostQuery(new TermQuery(new Term("field", "T")), 2.0f), ft.termQuery("true", null));
assertParseMaximalWarnings();
}

Expand All @@ -235,16 +227,6 @@ public void testIndexedValueForSearch() throws Exception {
BooleanFieldMapper.Values.FALSE
);

assertEquals(
new BooleanFieldMapper.BooleanFieldType("bool").indexedValueForSearch(new BytesRef("T")),
BooleanFieldMapper.Values.TRUE
);

assertEquals(
new BooleanFieldMapper.BooleanFieldType("bool").indexedValueForSearch(new BytesRef("F")),
BooleanFieldMapper.Values.FALSE
);

IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> new BooleanFieldMapper.BooleanFieldType("bool").indexedValueForSearch(new BytesRef("random"))
Expand Down

0 comments on commit f942eaa

Please sign in to comment.