当前位置: 首页>>代码示例>>Java>>正文


Java CacheEntry.getValue方法代码示例

本文整理汇总了Java中org.apache.lucene.search.FieldCache.CacheEntry.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java CacheEntry.getValue方法的具体用法?Java CacheEntry.getValue怎么用?Java CacheEntry.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.search.FieldCache.CacheEntry的用法示例。


在下文中一共展示了CacheEntry.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: check

import org.apache.lucene.search.FieldCache.CacheEntry; //导入方法依赖的package包/类
/**
 * Tests a CacheEntry[] for indication of "insane" cache usage.
 * <p>
 * <B>NOTE:</b>FieldCache CreationPlaceholder objects are ignored.
 * (:TODO: is this a bad idea? are we masking a real problem?)
 * </p>
 */
public Insanity[] check(CacheEntry... cacheEntries) {
  if (null == cacheEntries || 0 == cacheEntries.length) 
    return new Insanity[0];

  // the indirect mapping lets MapOfSet dedup identical valIds for us
  //
  // maps the (valId) identityhashCode of cache values to 
  // sets of CacheEntry instances
  final MapOfSets<Integer, CacheEntry> valIdToItems = new MapOfSets<>(new HashMap<Integer, Set<CacheEntry>>(17));
  // maps ReaderField keys to Sets of ValueIds
  final MapOfSets<ReaderField, Integer> readerFieldToValIds = new MapOfSets<>(new HashMap<ReaderField, Set<Integer>>(17));
  //

  // any keys that we know result in more then one valId
  final Set<ReaderField> valMismatchKeys = new HashSet<>();

  // iterate over all the cacheEntries to get the mappings we'll need
  for (int i = 0; i < cacheEntries.length; i++) {
    final CacheEntry item = cacheEntries[i];
    final Object val = item.getValue();

    // It's OK to have dup entries, where one is eg
    // float[] and the other is the Bits (from
    // getDocWithField())
    if (val != null && "BitsEntry".equals(val.getClass().getSimpleName())) {
      continue;
    }

    if (val instanceof FieldCache.CreationPlaceholder)
      continue;

    final ReaderField rf = new ReaderField(item.getReaderKey(), 
                                          item.getFieldName());

    final Integer valId = Integer.valueOf(System.identityHashCode(val));

    // indirect mapping, so the MapOfSet will dedup identical valIds for us
    valIdToItems.put(valId, item);
    if (1 < readerFieldToValIds.put(rf, valId)) {
      valMismatchKeys.add(rf);
    }
  }

  final List<Insanity> insanity = new ArrayList<>(valMismatchKeys.size() * 3);

  insanity.addAll(checkValueMismatch(valIdToItems, 
                                     readerFieldToValIds, 
                                     valMismatchKeys));
  insanity.addAll(checkSubreaders(valIdToItems, 
                                  readerFieldToValIds));
                  
  return insanity.toArray(new Insanity[insanity.size()]);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:61,代码来源:FieldCacheSanityChecker.java

示例2: check

import org.apache.lucene.search.FieldCache.CacheEntry; //导入方法依赖的package包/类
/**
 * Tests a CacheEntry[] for indication of "insane" cache usage.
 * <p>
 * <B>NOTE:</b>FieldCache CreationPlaceholder objects are ignored.
 * (:TODO: is this a bad idea? are we masking a real problem?)
 * </p>
 */
public Insanity[] check(CacheEntry... cacheEntries) {
  if (null == cacheEntries || 0 == cacheEntries.length) 
    return new Insanity[0];

  if (estimateRam) {
    for (int i = 0; i < cacheEntries.length; i++) {
      cacheEntries[i].estimateSize();
    }
  }

  // the indirect mapping lets MapOfSet dedup identical valIds for us
  //
  // maps the (valId) identityhashCode of cache values to 
  // sets of CacheEntry instances
  final MapOfSets<Integer, CacheEntry> valIdToItems = new MapOfSets<Integer, CacheEntry>(new HashMap<Integer, Set<CacheEntry>>(17));
  // maps ReaderField keys to Sets of ValueIds
  final MapOfSets<ReaderField, Integer> readerFieldToValIds = new MapOfSets<ReaderField, Integer>(new HashMap<ReaderField, Set<Integer>>(17));
  //

  // any keys that we know result in more then one valId
  final Set<ReaderField> valMismatchKeys = new HashSet<ReaderField>();

  // iterate over all the cacheEntries to get the mappings we'll need
  for (int i = 0; i < cacheEntries.length; i++) {
    final CacheEntry item = cacheEntries[i];
    final Object val = item.getValue();

    // It's OK to have dup entries, where one is eg
    // float[] and the other is the Bits (from
    // getDocWithField())
    if (val instanceof Bits) {
      continue;
    }

    if (val instanceof FieldCache.CreationPlaceholder)
      continue;

    final ReaderField rf = new ReaderField(item.getReaderKey(), 
                                          item.getFieldName());

    final Integer valId = Integer.valueOf(System.identityHashCode(val));

    // indirect mapping, so the MapOfSet will dedup identical valIds for us
    valIdToItems.put(valId, item);
    if (1 < readerFieldToValIds.put(rf, valId)) {
      valMismatchKeys.add(rf);
    }
  }

  final List<Insanity> insanity = new ArrayList<Insanity>(valMismatchKeys.size() * 3);

  insanity.addAll(checkValueMismatch(valIdToItems, 
                                     readerFieldToValIds, 
                                     valMismatchKeys));
  insanity.addAll(checkSubreaders(valIdToItems, 
                                  readerFieldToValIds));
                  
  return insanity.toArray(new Insanity[insanity.size()]);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:67,代码来源:FieldCacheSanityChecker.java


注:本文中的org.apache.lucene.search.FieldCache.CacheEntry.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。