Search in sources :

Example 16 with NumericDoubleValues

use of org.elasticsearch.index.fielddata.NumericDoubleValues in project elasticsearch by elastic.

the class MultiValueModeTests method testSingleValuedDoubles.

public void testSingleValuedDoubles() throws Exception {
    final int numDocs = scaledRandomIntBetween(1, 100);
    final double[] array = new double[numDocs];
    final FixedBitSet docsWithValue = randomBoolean() ? null : new FixedBitSet(numDocs);
    for (int i = 0; i < array.length; ++i) {
        if (randomBoolean()) {
            array[i] = randomDouble();
            if (docsWithValue != null) {
                docsWithValue.set(i);
            }
        } else if (docsWithValue != null && randomBoolean()) {
            docsWithValue.set(i);
        }
    }
    final NumericDoubleValues singleValues = new NumericDoubleValues() {

        @Override
        public double get(int docID) {
            return array[docID];
        }
    };
    final SortedNumericDoubleValues multiValues = FieldData.singleton(singleValues, docsWithValue);
    verify(multiValues, numDocs);
    final FixedBitSet rootDocs = randomRootDocs(numDocs);
    final FixedBitSet innerDocs = randomInnerDocs(rootDocs);
    verify(multiValues, numDocs, rootDocs, innerDocs);
}
Also used : FixedBitSet(org.apache.lucene.util.FixedBitSet) NumericDoubleValues(org.elasticsearch.index.fielddata.NumericDoubleValues) SortedNumericDoubleValues(org.elasticsearch.index.fielddata.SortedNumericDoubleValues) SortedNumericDoubleValues(org.elasticsearch.index.fielddata.SortedNumericDoubleValues)

Aggregations

NumericDoubleValues (org.elasticsearch.index.fielddata.NumericDoubleValues)16 SortedNumericDoubleValues (org.elasticsearch.index.fielddata.SortedNumericDoubleValues)12 LeafReaderContext (org.apache.lucene.index.LeafReaderContext)4 DoubleDocValues (org.apache.lucene.queries.function.docvalues.DoubleDocValues)3 DocIdSetIterator (org.apache.lucene.search.DocIdSetIterator)3 BitSet (org.apache.lucene.util.BitSet)3 BigArrays (org.elasticsearch.common.util.BigArrays)3 AtomicNumericFieldData (org.elasticsearch.index.fielddata.AtomicNumericFieldData)3 LeafBucketCollectorBase (org.elasticsearch.search.aggregations.LeafBucketCollectorBase)3 Scorer (org.apache.lucene.search.Scorer)2 SortField (org.apache.lucene.search.SortField)2 FixedBitSet (org.apache.lucene.util.FixedBitSet)2 IndexFieldData (org.elasticsearch.index.fielddata.IndexFieldData)2 Nested (org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested)2 MultiGeoPointValues (org.elasticsearch.index.fielddata.MultiGeoPointValues)2 MultiValueMode (org.elasticsearch.search.MultiValueMode)2 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 BinaryDocValues (org.apache.lucene.index.BinaryDocValues)1 BitSetIterator (org.apache.lucene.util.BitSetIterator)1