Skip to content

Commit

Permalink
Fixing some 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 Dec 7, 2023
1 parent 3eb4316 commit a89340f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ setup:
integer: 1
long: 1
short: 1
unsigned_long: 1
unsigned_long: 10223372036854775807

- do:
headers:
Expand All @@ -78,7 +78,7 @@ setup:
integer: 1
long: 1
short: 1
unsigned_long: 1
unsigned_long: 10223372036854775807


- do:
Expand All @@ -95,7 +95,7 @@ setup:
integer: 1
long: 1
short: 1
unsigned_long: 1
unsigned_long: 10223372036854775807


- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
* compatible open source license.
*/

package org.apache.lucene.document;
package org.apache.lucene.util;

import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.packed.PackedInts;

import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package org.opensearch.index.document;

import org.apache.lucene.document.LongHashSet;
import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.LeafReader;
Expand All @@ -25,6 +24,7 @@
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.TwoPhaseIterator;
import org.apache.lucene.search.Weight;
import org.apache.lucene.util.LongHashSet;

import java.io.IOException;
import java.math.BigInteger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ public Query termsQuery(String field, List<Object> values, boolean hasDocValues,
long points[] = new long[v.length];
for (int i = 0; i < values.size(); ++i) {
v[i] = parse(values.get(i), false);
points[i] = HalfFloatPoint.halfFloatToSortableShort(v[i]);
if (hasDocValues) {
points[i] = HalfFloatPoint.halfFloatToSortableShort(v[i]);
}
}
if (isSearchable && hasDocValues) {
Query query = HalfFloatPoint.newSetQuery(field, v);
Expand Down Expand Up @@ -357,7 +359,9 @@ public Query termsQuery(String field, List<Object> values, boolean hasDocValues,
long points[] = new long[v.length];
for (int i = 0; i < values.size(); ++i) {
v[i] = parse(values.get(i), false);
points[i] = NumericUtils.floatToSortableInt(v[i]);
if (hasDocValues) {
points[i] = NumericUtils.floatToSortableInt(v[i]);
}
}
if (isSearchable && hasDocValues) {
return new IndexOrDocValuesQuery(
Expand Down Expand Up @@ -481,7 +485,9 @@ public Query termsQuery(String field, List<Object> values, boolean hasDocValues,
long points[] = new long[v.length];
for (int i = 0; i < values.size(); ++i) {
v[i] = parse(values.get(i), false);
points[i] = NumericUtils.doubleToSortableLong(v[i]);
if (hasDocValues) {
points[i] = NumericUtils.doubleToSortableLong(v[i]);
}
}
if (isSearchable && hasDocValues) {
return new IndexOrDocValuesQuery(
Expand Down Expand Up @@ -758,8 +764,10 @@ public Query termsQuery(String field, List<Object> values, boolean hasDocValues,
v = Arrays.copyOf(v, upTo);
}
long points[] = new long[v.length];
for (int i = 0; i < v.length; i++) {
points[i] = v[i];
if (hasDocValues) {
for (int i = 0; i < v.length; i++) {
points[i] = v[i];
}
}
if (isSearchable && hasDocValues) {
return new IndexOrDocValuesQuery(
Expand Down Expand Up @@ -999,14 +1007,12 @@ public Query termQuery(String field, Object value, boolean hasDocValues, boolean
@Override
public Query termsQuery(String field, List<Object> values, boolean hasDocvalues, boolean isSearchable) {
BigInteger[] v = new BigInteger[values.size()];
long points[] = new long[v.length];
int upTo = 0;

for (int i = 0; i < values.size(); i++) {
Object value = values.get(i);
if (!hasDecimalPart(value)) {
v[upTo++] = parse(value, true);
points[i] = v[i].longValue();
}
}

Expand Down

0 comments on commit a89340f

Please sign in to comment.