Package org.apache.lucene.util

Examples of org.apache.lucene.util.BytesRefBuilder


  public static void fillQueue(TermsEnum termsEnum, TermStatsQueue tiq, String field) throws Exception {
   
  while (true) {
      BytesRef term = termsEnum.next();
      if (term != null) {
        BytesRefBuilder r = new BytesRefBuilder();
        r.copyBytes(term);
        tiq.insertWithOverflow(new TermStats(field, r.get(), termsEnum.docFreq()));
      } else {
        break;
      }
    }
  }
View Full Code Here


                    count = in.readVInt();
                    if (count > refs.length) {
                        final int previousLength = refs.length;
                        refs = Arrays.copyOf(refs, ArrayUtil.oversize(count, RamUsageEstimator.NUM_BYTES_OBJECT_REF));
                        for (int i = previousLength; i < refs.length; ++i) {
                            refs[i] = new BytesRefBuilder();
                        }
                    }
                    for (int i = 0; i < count; ++i) {
                        final int length = in.readVInt();
                        final BytesRefBuilder scratch = refs[i];
                        scratch.grow(length);
                        in.readBytes(scratch.bytes(), 0, length);
                        scratch.setLength(length);
                    }
                }
            }

            @Override
View Full Code Here

        protected final Arc<Long> scratchArc = new Arc<>();
        protected final IntsRefBuilder scratchInts = new IntsRefBuilder();

        ValuesHolder(FST<Long> fst) {
            this.fst = fst;
            scratch = new BytesRefBuilder();
            in = fst.getBytesReader();
        }
View Full Code Here

        return Short.parseShort(value.toString());
    }

    @Override
    public BytesRef indexedValueForSearch(Object value) {
        BytesRefBuilder bytesRef = new BytesRefBuilder();
        NumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef)// 0 because of exact match
        return bytesRef.get();
    }
View Full Code Here

        return dateTimeFormatter.printer().print(val);
    }

    @Override
    public BytesRef indexedValueForSearch(Object value) {
        BytesRefBuilder bytesRef = new BytesRefBuilder();
        NumericUtils.longToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match
        return bytesRef.get();
    }
View Full Code Here

    public BytesRef toBytesRef() {
        return createUidAsBytes(type, id);
    }

    public static BytesRef typePrefixAsBytes(BytesRef type) {
        BytesRefBuilder bytesRef = new BytesRefBuilder();
        bytesRef.append(type);
        bytesRef.append(DELIMITER_BYTES);
        return bytesRef.toBytesRef();
    }
View Full Code Here

    }

    public static BytesRef[] createTypeUids(Collection<String> types, List<? extends Object> ids) {
        final int numIds = ids.size();
        BytesRef[] uids = new BytesRef[types.size() * ids.size()];
        BytesRefBuilder typeBytes = new BytesRefBuilder();
        BytesRefBuilder idBytes = new BytesRefBuilder();
        int index = 0;
        for (String type : types) {
            typeBytes.copyChars(type);
            for (int i = 0; i < numIds; i++, index++) {
                uids[index] = Uid.createUidAsBytes(typeBytes.get(), BytesRefs.toBytesRef(ids.get(i), idBytes));
View Full Code Here

    }

    @Override
    public BytesRef indexedValueForSearch(Object value) {
        int intValue = NumericUtils.floatToSortableInt(parseValue(value));
        BytesRefBuilder bytesRef = new BytesRefBuilder();
        NumericUtils.intToPrefixCoded(intValue, precisionStep(), bytesRef);
        return bytesRef.get();
    }
View Full Code Here

        return Long.parseLong(value.toString());
    }

    @Override
    public BytesRef indexedValueForSearch(Object value) {
        BytesRefBuilder bytesRef = new BytesRefBuilder();
        NumericUtils.longToPrefixCoded(parseLongValue(value), 0, bytesRef)// 0 because of exact match
        return bytesRef.get();
    }
View Full Code Here

        return Byte.parseByte(value.toString());
    }

    @Override
    public BytesRef indexedValueForSearch(Object value) {
        BytesRefBuilder bytesRef = new BytesRefBuilder();
        NumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match
        return bytesRef.get();
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.util.BytesRefBuilder

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.