Package org.apache.lucene.index

Examples of org.apache.lucene.index.RandomAccessOrds


          return new MinValue(sortedSet);
        } else {
          if (sortedSet instanceof RandomAccessOrds == false) {
            throw new UnsupportedOperationException("codec does not support random access ordinals, cannot use selector: " + selector);
          }
          RandomAccessOrds randomOrds = (RandomAccessOrds) sortedSet;
          switch(selector) {
            case MAX: return new MaxValue(randomOrds);
            case MIDDLE_MIN: return new MiddleMinValue(randomOrds);
            case MIDDLE_MAX: return new MiddleMaxValue(randomOrds);
            case MIN:
View Full Code Here


    final LongBinaryDocValues binary = (LongBinaryDocValues) getBinary(field);
    final LongValues ordinals = getNumeric(ords.get(field.number));
    // but the addresses to the ord stream are in RAM
    final MonotonicBlockPackedReader ordIndex = getOrdIndexInstance(data, field, ordIndexes.get(field.number));
   
    return new RandomAccessOrds() {
      long startOffset;
      long offset;
      long endOffset;
     
      @Override
View Full Code Here

    final LongBinaryDocValues binary = (LongBinaryDocValues) getBinary(field);
    final LongValues ordinals = getNumeric(ords.get(field.number));
    // but the addresses to the ord stream are in RAM
    final MonotonicBlockPackedReader ordIndex = getOrdIndexInstance(data, field, ordIndexes.get(field.number));
   
    return new RandomAccessOrds() {
      long startOffset;
      long offset;
      long endOffset;
     
      @Override
View Full Code Here

      final NumericDocValues docToOrdAddress = instance.docToOrdAddress;
      final NumericDocValues ords = instance.ords;
      final BinaryDocValues values = getBinary(field);
     
      // Must make a new instance since the iterator has state:
      return new RandomAccessOrds() {
        int ordStart;
        int ordUpto;
        int ordLimit;
       
        @Override
View Full Code Here

    final NumericDocValues docToOrdAddress = instance.docToOrdAddress;
    final NumericDocValues ords = instance.ords;
    final BinaryDocValues values = instance.values;

    // Must make a new instance since the iterator has state:
    return new RandomAccessOrds() {
      int ordStart;
      int ordUpto;
      int ordLimit;

      @Override
View Full Code Here

          return new MinValue(sortedSet);
        } else {
          if (sortedSet instanceof RandomAccessOrds == false) {
            throw new UnsupportedOperationException("codec does not support random access ordinals, cannot use selector: " + selector);
          }
          RandomAccessOrds randomOrds = (RandomAccessOrds) sortedSet;
          switch(selector) {
            case MAX: return new MaxValue(randomOrds);
            case MIDDLE_MIN: return new MiddleMinValue(randomOrds);
            case MIDDLE_MAX: return new MiddleMaxValue(randomOrds);
            case MIN:
View Full Code Here

    final LongBinaryDocValues binary = (LongBinaryDocValues) getBinary(field);
    final LongValues ordinals = getNumeric(ords.get(field.number));
    // but the addresses to the ord stream are in RAM
    final MonotonicBlockPackedReader ordIndex = getOrdIndexInstance(data, field, ordIndexes.get(field.number));
   
    return new RandomAccessOrds() {
      long startOffset;
      long offset;
      long endOffset;
     
      @Override
View Full Code Here

            return Collections.unmodifiableList(resources);
        }

        @Override
        public MultiGeoPointValues getGeoPointValues() {
            final RandomAccessOrds ords = ordinals.ordinals();
            final SortedDocValues singleOrds = DocValues.unwrapSingleton(ords);
            if (singleOrds != null) {
                final GeoPoint point = new GeoPoint();
                final GeoPointValues values = new GeoPointValues() {
                    @Override
                    public GeoPoint get(int docID) {
                        final int ord = singleOrds.getOrd(docID);
                        if (ord >= 0) {
                            point.reset(lat.get(ord), lon.get(ord));
                        }
                        return point;
                    }
                };
                return FieldData.singleton(values, DocValues.docsWithValue(singleOrds, maxDoc));
            } else {
                final GeoPoint point = new GeoPoint();
                return new MultiGeoPointValues() {

                    @Override
                    public GeoPoint valueAt(int index) {
                        final long ord = ords.ordAt(index);
                        point.reset(lat.get(ord), lon.get(ord));
                        return point;
                    }

                    @Override
                    public void setDocument(int docId) {
                        ords.setDocument(docId);
                    }

                    @Override
                    public int count() {
                        return ords.cardinality();
                    }
                };
            }
        }
View Full Code Here

            }
            lat = BigArrays.NON_RECYCLING_INSTANCE.resize(lat, numTerms);
            lon = BigArrays.NON_RECYCLING_INSTANCE.resize(lon, numTerms);

            Ordinals build = builder.build(fieldDataType.getSettings());
            RandomAccessOrds ordinals = build.ordinals();
            if (!(FieldData.isMultiValued(ordinals) || CommonSettings.getMemoryStorageHint(fieldDataType) == CommonSettings.MemoryStorageFormat.ORDINALS)) {
                int maxDoc = reader.maxDoc();
                DoubleArray sLat = BigArrays.NON_RECYCLING_INSTANCE.newDoubleArray(reader.maxDoc());
                DoubleArray sLon = BigArrays.NON_RECYCLING_INSTANCE.newDoubleArray(reader.maxDoc());
                for (int i = 0; i < maxDoc; i++) {
                    ordinals.setDocument(i);
                    long nativeOrdinal = ordinals.nextOrd();
                    if (nativeOrdinal != RandomAccessOrds.NO_MORE_ORDS) {
                        sLat.set(i, lat.get(nativeOrdinal));
                        sLon.set(i, lon.get(nativeOrdinal));
                    }
                }
View Full Code Here

            return Collections.unmodifiableList(resources);
        }

        @Override
        public MultiGeoPointValues getGeoPointValues() {
            final RandomAccessOrds ords = ordinals.ordinals();
            final SortedDocValues singleOrds = DocValues.unwrapSingleton(ords);
            if (singleOrds != null) {
                final GeoPoint point = new GeoPoint();
                final GeoPointValues values = new GeoPointValues() {
                    @Override
                    public GeoPoint get(int docID) {
                        final int ord = singleOrds.getOrd(docID);
                        if (ord >= 0) {
                            encoding.decode(lat.get(ord), lon.get(ord), point);
                        } else {
                            point.reset(0, 0);
                        }
                        return point;
                    }
                };
                return FieldData.singleton(values, DocValues.docsWithValue(singleOrds, maxDoc));
            } else {
                final GeoPoint point = new GeoPoint();
                return new MultiGeoPointValues() {

                    @Override
                    public GeoPoint valueAt(int index) {
                        final long ord = ords.ordAt(index);
                        encoding.decode(lat.get(ord), lon.get(ord), point);
                        return point;
                    }

                    @Override
                    public void setDocument(int docId) {
                        ords.setDocument(docId);
                    }

                    @Override
                    public int count() {
                        return ords.cardinality();
                    }
                };
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.RandomAccessOrds

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.