use of org.apache.lucene.search.FieldValueQuery in project elasticsearch by elastic.
the class MaxAggregatorTests method testSomeMatchesSortedNumericDocValues.
public void testSomeMatchesSortedNumericDocValues() throws IOException {
testCase(new FieldValueQuery("number"), iw -> {
iw.addDocument(singleton(new SortedNumericDocValuesField("number", 7)));
iw.addDocument(singleton(new SortedNumericDocValuesField("number", 1)));
}, max -> {
assertEquals(7, max.getValue(), 0);
});
}
use of org.apache.lucene.search.FieldValueQuery in project elasticsearch by elastic.
the class AvgAggregatorTests method testSomeMatchesSortedNumericDocValues.
public void testSomeMatchesSortedNumericDocValues() throws IOException {
testCase(new FieldValueQuery("number"), iw -> {
iw.addDocument(singleton(new SortedNumericDocValuesField("number", 7)));
iw.addDocument(singleton(new SortedNumericDocValuesField("number", 2)));
iw.addDocument(singleton(new SortedNumericDocValuesField("number", 3)));
}, avg -> {
assertEquals(4, avg.getValue(), 0);
});
}
use of org.apache.lucene.search.FieldValueQuery in project elasticsearch by elastic.
the class ValueCountAggregatorTests method testSomeMatchesSortedNumericDocValues.
public void testSomeMatchesSortedNumericDocValues() throws IOException {
testCase(new FieldValueQuery(FIELD_NAME), ValueType.NUMERIC, iw -> {
iw.addDocument(singleton(new SortedNumericDocValuesField("wrong_number", 7)));
iw.addDocument(singleton(new SortedNumericDocValuesField(FIELD_NAME, 7)));
iw.addDocument(singleton(new SortedNumericDocValuesField(FIELD_NAME, 1)));
}, count -> assertEquals(2L, count.getValue()));
}
use of org.apache.lucene.search.FieldValueQuery in project elasticsearch by elastic.
the class SumAggregatorTests method testSortedNumericDocValues.
public void testSortedNumericDocValues() throws IOException {
testCase(new FieldValueQuery(FIELD_NAME), iw -> {
iw.addDocument(Arrays.asList(new SortedNumericDocValuesField(FIELD_NAME, 3), new SortedNumericDocValuesField(FIELD_NAME, 4)));
iw.addDocument(Arrays.asList(new SortedNumericDocValuesField(FIELD_NAME, 3), new SortedNumericDocValuesField(FIELD_NAME, 4)));
iw.addDocument(singleton(new SortedNumericDocValuesField(FIELD_NAME, 1)));
}, count -> assertEquals(15L, count.getValue(), 0d));
}
use of org.apache.lucene.search.FieldValueQuery in project elasticsearch by elastic.
the class AvgAggregatorTests method testSomeMatchesNumericDocValues.
public void testSomeMatchesNumericDocValues() throws IOException {
testCase(new FieldValueQuery("number"), iw -> {
iw.addDocument(singleton(new NumericDocValuesField("number", 7)));
iw.addDocument(singleton(new NumericDocValuesField("number", 2)));
iw.addDocument(singleton(new NumericDocValuesField("number", 3)));
}, avg -> {
assertEquals(4, avg.getValue(), 0);
});
}
Aggregations