當前位置: 首頁>>代碼示例>>Java>>正文


Java Bits.MatchAllBits方法代碼示例

本文整理匯總了Java中org.apache.lucene.util.Bits.MatchAllBits方法的典型用法代碼示例。如果您正苦於以下問題:Java Bits.MatchAllBits方法的具體用法?Java Bits.MatchAllBits怎麽用?Java Bits.MatchAllBits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.lucene.util.Bits的用法示例。


在下文中一共展示了Bits.MatchAllBits方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMissingBits

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
private Bits getMissingBits(final long offset) throws IOException {
  if (offset == -1) {
    return new Bits.MatchAllBits(maxDoc);
  } else {
    final IndexInput in = data.clone();
    return new Bits() {

      @Override
      public boolean get(int index) {
        try {
          in.seek(offset + (index >> 3));
          return (in.readByte() & (1 << (index & 7))) != 0;
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      @Override
      public int length() {
        return maxDoc;
      }
    };
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:Lucene45DocValuesProducer.java

示例2: getMissingBits

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
private Bits getMissingBits(final long offset) throws IOException {
  if (offset == -1) {
    return new Bits.MatchAllBits(maxDoc);
  } else {
    int length = (int) ((maxDoc + 7L) >>> 3);
    final RandomAccessInput in = data.randomAccessSlice(offset, length);
    return new Bits() {
      @Override
      public boolean get(int index) {
        try {
          return (in.readByte(index >> 3) & (1 << (index & 7))) != 0;
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      @Override
      public int length() {
        return maxDoc;
      }
    };
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:Lucene49DocValuesProducer.java

示例3: getDocsWithField

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  if (field.getDocValuesType() == FieldInfo.DocValuesType.SORTED_SET) {
    return DocValues.docsWithValue(getSortedSet(field), maxDoc);
  } else {
    return new Bits.MatchAllBits(maxDoc);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:Lucene42DocValuesProducer.java

示例4: setNextReader

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public FieldComparator<T> setNextReader(AtomicReaderContext context) throws IOException {
  if (missingValue != null) {
    docsWithField = FieldCache.DEFAULT.getDocsWithField(context.reader(), field);
    // optimization to remove unneeded checks on the bit interface:
    if (docsWithField instanceof Bits.MatchAllBits) {
      docsWithField = null;
    }
  } else {
    docsWithField = null;
  }
  return this;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:FieldComparator.java

示例5: ramBytesUsed

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public long ramBytesUsed() {
  long base = RamUsageEstimator.NUM_BYTES_OBJECT_REF;
  if (bits instanceof Bits.MatchAllBits || bits instanceof Bits.MatchNoBits) {
    return base;
  } else {
    return base + (bits.length() >>> 3);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:FieldCacheImpl.java

示例6: getDocsWithField

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
/** Returns a Bits for a reader's docsWithField (potentially merging on-the-fly) 
 * <p>
 * This is a slow way to access this bitset. Instead, access them per-segment
 * with {@link AtomicReader#getDocsWithField(String)}
 * </p> 
 * */
public static Bits getDocsWithField(final IndexReader r, final String field) throws IOException {
  final List<AtomicReaderContext> leaves = r.leaves();
  final int size = leaves.size();
  if (size == 0) {
    return null;
  } else if (size == 1) {
    return leaves.get(0).reader().getDocsWithField(field);
  }

  boolean anyReal = false;
  boolean anyMissing = false;
  final Bits[] values = new Bits[size];
  final int[] starts = new int[size+1];
  for (int i = 0; i < size; i++) {
    AtomicReaderContext context = leaves.get(i);
    Bits v = context.reader().getDocsWithField(field);
    if (v == null) {
      v = new Bits.MatchNoBits(context.reader().maxDoc());
      anyMissing = true;
    } else {
      anyReal = true;
      if (v instanceof Bits.MatchAllBits == false) {
        anyMissing = true;
      }
    }
    values[i] = v;
    starts[i] = context.docBase;
  }
  starts[size] = r.maxDoc();

  if (!anyReal) {
    return null;
  } else if (!anyMissing) {
    return new Bits.MatchAllBits(r.maxDoc());
  } else {
    return new MultiBits(values, starts, false);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:45,代碼來源:MultiDocValues.java

示例7: getDocsWithField

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
    if (VersionFieldMapper.NAME.equals(field.name)) {
        return new Bits.MatchAllBits(reader.maxDoc());
    } else {
        return in.getDocsWithField(field);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:VersionFieldUpgrader.java

示例8: getDocsWithField

import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  return new Bits.MatchAllBits(state.segmentInfo.getDocCount());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:Lucene40DocValuesReader.java


注:本文中的org.apache.lucene.util.Bits.MatchAllBits方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。