Examples of BinaryDocValues


Examples of org.apache.lucene.index.BinaryDocValues

    final IndexInput in = data.clone();
    final BytesRef scratch = new BytesRef();
    final DecimalFormat decoder = new DecimalFormat(field.pattern, new DecimalFormatSymbols(Locale.ROOT));

    return new BinaryDocValues() {
      @Override
      public void get(int docID, BytesRef result) {
        try {
          if (docID < 0 || docID >= maxDoc) {
            throw new IndexOutOfBoundsException("docID must be 0 .. " + (maxDoc-1) + "; got " + docID);
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

  }

  private final void sumValues(List<MatchingDocs> matchingDocs) throws IOException {
    //System.out.println("count matchingDocs=" + matchingDocs + " facetsField=" + facetsFieldName);
    for(MatchingDocs hits : matchingDocs) {
      BinaryDocValues dv = hits.context.reader().getBinaryDocValues(indexFieldName);
      if (dv == null) { // this reader does not have DocValues for the requested category list
        continue;
      }
     
      BytesRef scratch = new BytesRef();
      DocIdSetIterator docs = hits.bits.iterator();
     
      int doc;
      while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
        //System.out.println("  doc=" + doc);
        // TODO: use OrdinalsReader?  we'd need to add a
        // BytesRef getAssociation()?
        dv.get(doc, scratch);
        byte[] bytes = scratch.bytes;
        int end = scratch.offset + scratch.length;
        int offset = scratch.offset;
        while (offset < end) {
          int ord = ((bytes[offset]&0xFF) << 24) |
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

  }

  @Override
  public SortedDocValues getSorted(FieldInfo field) throws IOException {
    final int valueCount = (int) binaries.get(field.number).count;
    final BinaryDocValues binary = getBinary(field);
    NumericEntry entry = ords.get(field.number);
    IndexInput data = this.data.clone();
    data.seek(entry.offset);
    final BlockPackedReader ordinals = new BlockPackedReader(data, entry.packedIntsVersion, entry.blockSize, entry.count, true);
   
    return new SortedDocValues() {

      @Override
      public int getOrd(int docID) {
        return (int) ordinals.get(docID);
      }

      @Override
      public void lookupOrd(int ord, BytesRef result) {
        binary.get(ord, result);
      }

      @Override
      public int getValueCount() {
        return valueCount;
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

  }

  private final void sumValues(List<MatchingDocs> matchingDocs) throws IOException {
    //System.out.println("count matchingDocs=" + matchingDocs + " facetsField=" + facetsFieldName);
    for(MatchingDocs hits : matchingDocs) {
      BinaryDocValues dv = hits.context.reader().getBinaryDocValues(indexFieldName);
      if (dv == null) { // this reader does not have DocValues for the requested category list
        continue;
      }
   
      BytesRef scratch = new BytesRef();
      DocIdSetIterator docs = hits.bits.iterator();
     
      int doc;
      while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
        //System.out.println("  doc=" + doc);
        // TODO: use OrdinalsReader?  we'd need to add a
        // BytesRef getAssociation()?
        dv.get(doc, scratch);
        byte[] bytes = scratch.bytes;
        int end = scratch.offset + scratch.length;
        int offset = scratch.offset;
        while (offset < end) {
          int ord = ((bytes[offset]&0xFF) << 24) |
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

    this.field = field;
  }

  @Override
  public OrdinalsSegmentReader getReader(AtomicReaderContext context) throws IOException {
    BinaryDocValues values0 = context.reader().getBinaryDocValues(field);
    if (values0 == null) {
      values0 = BinaryDocValues.EMPTY;
    }

    final BinaryDocValues values = values0;

    return new OrdinalsSegmentReader() {
      private final BytesRef bytes = new BytesRef(32);

      @Override
      public void get(int docID, IntsRef ordinals) throws IOException {
        values.get(docID, bytes);
        decode(bytes, ordinals);
      }
    };
  }
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

    }

    @Override
    public BinaryDocValues getBinary(FieldInfo field) throws IOException {
      assert field.getDocValuesType() == FieldInfo.DocValuesType.BINARY;
      BinaryDocValues values = in.getBinary(field);
      assert values != null;
      return new AssertingAtomicReader.AssertingBinaryDocValues(values, maxDoc);
    }
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

      Document hitDoc = isearcher.doc(hits.scoreDocs[i].doc);
      assertEquals(text, hitDoc.get("fieldname"));
      assert ireader.leaves().size() == 1;
      NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv1");
      assertEquals(5, dv.get(hits.scoreDocs[i].doc));
      BinaryDocValues dv2 = ireader.leaves().get(0).reader().getBinaryDocValues("dv2");
      dv2.get(hits.scoreDocs[i].doc, scratch);
      assertEquals(new BytesRef("hello world"), scratch);
    }

    ireader.close();
    directory.close();
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

  public final void aggregate(MatchingDocs matchingDocs, CategoryListParams clp, FacetArrays facetArrays)
      throws IOException {
    assert clp.createEncoder().createMatchingDecoder().getClass() == DGapVInt8IntDecoder.class
        : "this aggregator assumes ordinals were encoded as dgap+vint";
   
    final BinaryDocValues dv = matchingDocs.context.reader().getBinaryDocValues(clp.field);
    if (dv == null) { // this reader does not have DocValues for the requested category list
      return;
    }
   
    final int length = matchingDocs.bits.length();
    final int[] counts = facetArrays.getIntArray();
    int doc = 0;
    while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
      dv.get(doc, buf);
      if (buf.length > 0) {
        // this document has facets
        final int upto = buf.offset + buf.length;
        int ord = 0;
        int offset = buf.offset;
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

  private final BytesRef bytes = new BytesRef(32);
 
  @Override
  public void aggregate(MatchingDocs matchingDocs, CategoryListParams clp, FacetArrays facetArrays) throws IOException {
    BinaryDocValues dv = matchingDocs.context.reader().getBinaryDocValues(clp.field + CategoryIntAssociation.ASSOCIATION_LIST_ID);
    if (dv == null) {
      return; // no int associations in this reader
    }
   
    final int length = matchingDocs.bits.length();
    final int[] values = facetArrays.getIntArray();
    int doc = 0;
    while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
      dv.get(doc, bytes);
      if (bytes.length == 0) {
        continue; // no associations for this document
      }

      // aggreate association values for ordinals
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

  private final BytesRef bytes = new BytesRef(32);
 
  @Override
  public void aggregate(MatchingDocs matchingDocs, CategoryListParams clp, FacetArrays facetArrays) throws IOException {
    BinaryDocValues dv = matchingDocs.context.reader().getBinaryDocValues(clp.field + CategoryFloatAssociation.ASSOCIATION_LIST_ID);
    if (dv == null) {
      return; // no float associations in this reader
    }
   
    final int length = matchingDocs.bits.length();
    final float[] values = facetArrays.getFloatArray();
    int doc = 0;
    while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
      dv.get(doc, bytes);
      if (bytes.length == 0) {
        continue; // no associations for this document
      }

      // aggreate float association values for ordinals
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.