Examples of BinaryDocValues


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

   * {@link AtomicReaderContext}, or {@code null} if there is no
   * {@link BinaryDocValues} in this reader for the requested
   * {@link CategoryListParams#field}.
   */
  public static synchronized CachedOrds getCachedOrds(AtomicReaderContext context, CategoryListParams clp) throws IOException {
    BinaryDocValues dv = context.reader().getBinaryDocValues(clp.field);
    if (dv == null) {
      return null;
    }
    Map<String,CachedOrds> fieldCache = ordsCache.get(context.reader().getCoreCacheKey());
    if (fieldCache == null) {
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) {
        // aggreate association values for ordinals
        int bytesUpto = bytes.offset + bytes.length;
        int pos = bytes.offset;
        while (pos < bytesUpto) {
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) {
        // aggreate float association values for ordinals
        int bytesUpto = bytes.offset + bytes.length;
        int pos = bytes.offset;
        while (pos < bytesUpto) {
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

    // test bad field
    termsIndex = cache.getTermsIndex(reader, "bogusfield");

    // getTerms
    BinaryDocValues terms = cache.getTerms(reader, "theRandomUnicodeString", true);
    assertSame("Second request to cache return same array", terms, cache.getTerms(reader, "theRandomUnicodeString", true));
    Bits bits = cache.getDocsWithField(reader, "theRandomUnicodeString");
    for (int i = 0; i < NUM_DOCS; i++) {
      terms.get(i, br);
      final BytesRef term;
      if (!bits.get(i)) {
        term = null;
      } else {
        term = br;
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

    try {
      FieldCache.DEFAULT.getInts(ar, "binary", false);
      fail();
    } catch (IllegalStateException expected) {}
   
    BinaryDocValues binary = FieldCache.DEFAULT.getTerms(ar, "binary", true);
    binary.get(0, scratch);
    assertEquals("binary value", scratch.utf8ToString());
   
    try {
      FieldCache.DEFAULT.getTermsIndex(ar, "binary");
      fail();
    } catch (IllegalStateException expected) {}
   
    try {
      FieldCache.DEFAULT.getDocTermOrds(ar, "binary");
      fail();
    } catch (IllegalStateException expected) {}
   
    try {
      new DocTermOrds(ar, null, "binary");
      fail();
    } catch (IllegalStateException expected) {}
   
    Bits bits = FieldCache.DEFAULT.getDocsWithField(ar, "binary");
    assertTrue(bits.get(0));
   
    // Sorted type: can be retrieved via getTerms(), getTermsIndex(), getDocTermOrds()
    try {
      FieldCache.DEFAULT.getInts(ar, "sorted", false);
      fail();
    } catch (IllegalStateException expected) {}
   
    try {
      new DocTermOrds(ar, null, "sorted");
      fail();
    } catch (IllegalStateException expected) {}
   
    binary = FieldCache.DEFAULT.getTerms(ar, "sorted", true);
    binary.get(0, scratch);
    assertEquals("sorted value", scratch.utf8ToString());
   
    SortedDocValues sorted = FieldCache.DEFAULT.getTermsIndex(ar, "sorted");
    assertEquals(0, sorted.getOrd(0));
    assertEquals(1, sorted.getValueCount());
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

   
    Doubles doubles = cache.getDoubles(ar, "bogusdoubles", true);
    assertEquals(0, doubles.get(0), 0.0D);
   
    BytesRef scratch = new BytesRef();
    BinaryDocValues binaries = cache.getTerms(ar, "bogusterms", true);
    binaries.get(0, scratch);
    assertEquals(0, scratch.length);
   
    SortedDocValues sorted = cache.getTermsIndex(ar, "bogustermsindex");
    assertEquals(-1, sorted.getOrd(0));
    sorted.get(0, scratch);
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

   
    Doubles doubles = cache.getDoubles(ar, "bogusdoubles", true);
    assertEquals(0, doubles.get(0), 0.0D);
   
    BytesRef scratch = new BytesRef();
    BinaryDocValues binaries = cache.getTerms(ar, "bogusterms", true);
    binaries.get(0, scratch);
    assertEquals(0, scratch.length);
   
    SortedDocValues sorted = cache.getTermsIndex(ar, "bogustermsindex");
    assertEquals(-1, sorted.getOrd(0));
    sorted.get(0, scratch);
View Full Code Here

Examples of org.apache.lucene.index.BinaryDocValues

    }
  }

  @Override
  public synchronized BinaryDocValues getBinary(FieldInfo field) throws IOException {
    BinaryDocValues instance = binaryInstances.get(field.number);
    if (instance == null) {
      instance = loadBinary(field);
      binaryInstances.put(field.number, instance);
    }
    return instance;
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.