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


Java SortedSetDocValues.setDocument方法代码示例

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


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

示例1: accumMultiGeneric

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
/** accumulates per-segment multi-valued facet counts, mapping to global ordinal space on-the-fly */
static void accumMultiGeneric(int counts[], int startTermIndex, SortedSetDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
  final LongValues ordMap = map == null ? null : map.getGlobalOrds(subIndex);
  int doc;
  while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
    si.setDocument(doc);
    // strange do-while to collect the missing count (first ord is NO_MORE_ORDS)
    int term = (int) si.nextOrd();
    if (term < 0) {
      if (startTermIndex == -1) {
        counts[0]++; // missing count
      }
      continue;
    }
    
    do {
      if (map != null) {
        term = (int) ordMap.get(term);
      }
      int arrIdx = term-startTermIndex;
      if (arrIdx>=0 && arrIdx<counts.length) counts[arrIdx]++;
    } while ((term = (int) si.nextOrd()) >= 0);
  }
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:25,代码来源:DocValuesFacets.java

示例2: testDocValues

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void testDocValues() throws IOException {
  assertU(adoc("id", "1", "floatdv", "4.5", "intdv", "-1", "intdv", "3", "stringdv", "value1", "stringdv", "value2"));
  assertU(commit());
  try (SolrCore core = h.getCoreInc()) {
    final RefCounted<SolrIndexSearcher> searcherRef = core.openNewSearcher(true, true);
    final SolrIndexSearcher searcher = searcherRef.get();
    try {
      final AtomicReader reader = searcher.getAtomicReader();
      assertEquals(1, reader.numDocs());
      final FieldInfos infos = reader.getFieldInfos();
      assertEquals(DocValuesType.SORTED_SET, infos.fieldInfo("stringdv").getDocValuesType());
      assertEquals(DocValuesType.SORTED_SET, infos.fieldInfo("floatdv").getDocValuesType());
      assertEquals(DocValuesType.SORTED_SET, infos.fieldInfo("intdv").getDocValuesType());

      SortedSetDocValues dv = reader.getSortedSetDocValues("stringdv");
      dv.setDocument(0);
      assertEquals(0, dv.nextOrd());
      assertEquals(1, dv.nextOrd());
      assertEquals(SortedSetDocValues.NO_MORE_ORDS, dv.nextOrd());
    } finally {
      searcherRef.decref();
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:DocValuesMultiTest.java

示例3: accumMulti

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
/** accumulates per-segment multi-valued facet counts, mapping to global ordinal space */
static void accumMulti(int counts[], int startTermIndex, SortedSetDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
  int doc;
  while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
    si.setDocument(doc);
    // strange do-while to collect the missing count (first ord is NO_MORE_ORDS)
    int term = (int) si.nextOrd();
    if (term < 0) {
      if (startTermIndex == -1) {
        counts[0]++; // missing count
      }
      continue;
    }
    
    do {
      if (map != null) {
        term = (int) map.getGlobalOrd(subIndex, term);
      }
      int arrIdx = term-startTermIndex;
      if (arrIdx>=0 && arrIdx<counts.length) counts[arrIdx]++;
    } while ((term = (int) si.nextOrd()) >= 0);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:24,代码来源:DocValuesFacets.java

示例4: accumMultiGeneric

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
/** accumulates per-segment multi-valued facet counts, mapping to global ordinal space on-the-fly */
static void accumMultiGeneric(int counts[], int startTermIndex, SortedSetDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
  int doc;
  while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
    si.setDocument(doc);
    // strange do-while to collect the missing count (first ord is NO_MORE_ORDS)
    int term = (int) si.nextOrd();
    if (term < 0) {
      if (startTermIndex == -1) {
        counts[0]++; // missing count
      }
      continue;
    }
    
    do {
      if (map != null) {
        term = (int) map.getGlobalOrd(subIndex, term);
      }
      int arrIdx = term-startTermIndex;
      if (arrIdx>=0 && arrIdx<counts.length) counts[arrIdx]++;
    } while ((term = (int) si.nextOrd()) >= 0);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:24,代码来源:DocValuesFacets.java

示例5: testSortedSetDocValuesField

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
@Test
public void testSortedSetDocValuesField() throws Exception {
  assumeTrue("default codec does not support SORTED_SET", defaultCodecSupportsSortedSet());
  SortedSetDocValues dv = reader.getSortedSetDocValues(SORTED_SET_DV_FIELD);
  int maxDoc = reader.maxDoc();
  BytesRef bytes = new BytesRef();
  for (int i = 0; i < maxDoc; i++) {
    dv.setDocument(i);
    dv.lookupOrd(dv.nextOrd(), bytes);
    int value = sortedValues[i].intValue();
    assertEquals("incorrect sorted-set DocValues for doc " + i, Integer.valueOf(value).toString(), bytes.utf8ToString());
    dv.lookupOrd(dv.nextOrd(), bytes);
    assertEquals("incorrect sorted-set DocValues for doc " + i, Integer.valueOf(value + 1).toString(), bytes.utf8ToString());
    assertEquals(SortedSetDocValues.NO_MORE_ORDS, dv.nextOrd());
  }
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:17,代码来源:SorterTestBase.java

示例6: accumMultiSeg

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
/** "typical" multi-valued faceting: not too many unique values, no prefixing. maps to global ordinals as a separate step */
static void accumMultiSeg(int counts[], SortedSetDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
  // First count in seg-ord space:
  final int segCounts[];
  if (map == null) {
    segCounts = counts;
  } else {
    segCounts = new int[1+(int)si.getValueCount()];
  }
  
  int doc;
  while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
    si.setDocument(doc);
    int term = (int) si.nextOrd();
    if (term < 0) {
      counts[0]++; // missing
    } else {
      do {
        segCounts[1+term]++;
      } while ((term = (int)si.nextOrd()) >= 0);
    }
  }
  
  // migrate to global ords (if necessary)
  if (map != null) {
    migrateGlobal(counts, segCounts, subIndex, map);
  }
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:29,代码来源:DocValuesFacets.java

示例7: testSortedSetDocValuesField

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
@Test
public void testSortedSetDocValuesField() throws Exception {
  assumeTrue("default codec does not support SORTED_SET", defaultCodecSupportsSortedSet());
  SortedSetDocValues dv = reader.getSortedSetDocValues(SORTED_SET_DV_FIELD);
  int maxDoc = reader.maxDoc();
  for (int i = 0; i < maxDoc; i++) {
    dv.setDocument(i);
    BytesRef bytes = dv.lookupOrd(dv.nextOrd());
    int value = sortedValues[i].intValue();
    assertEquals("incorrect sorted-set DocValues for doc " + i, Integer.valueOf(value).toString(), bytes.utf8ToString());
    bytes = dv.lookupOrd(dv.nextOrd());
    assertEquals("incorrect sorted-set DocValues for doc " + i, Integer.valueOf(value + 1).toString(), bytes.utf8ToString());
    assertEquals(SortedSetDocValues.NO_MORE_ORDS, dv.nextOrd());
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:SorterTestBase.java

示例8: write

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void write(int docId, AtomicReader reader, Writer out) throws IOException {
  SortedSetDocValues vals = reader.getSortedSetDocValues(this.field);
  vals.setDocument(docId);
  out.write('"');
  out.write(this.field);
  out.write('"');
  out.write(':');
  out.write('[');
  int v = 0;
  long ord = -1;
  while((ord = vals.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
    BytesRef ref = vals.lookupOrd(ord);
    fieldType.indexedToReadable(ref, cref);
    if(v > 0) {
      out.write(',');
    }

    if(!numeric) {
      out.write('"');
    }

    out.write(cref.toString());

    if(!numeric) {
      out.write('"');
    }
    ++v;
  }
  out.write("]");
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:SortingResponseWriter.java

示例9: testDocValues

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void testDocValues() throws IOException {
  assertU(adoc("id", "1", "floatdv", "4.5", "intdv", "-1", "intdv", "3", "stringdv", "value1", "stringdv", "value2"));
  commit();
  SolrCore core = h.getCoreInc();
  try {
    final RefCounted<SolrIndexSearcher> searcherRef = core.openNewSearcher(true, true);
    final SolrIndexSearcher searcher = searcherRef.get();
    try {
      final AtomicReader reader = searcher.getAtomicReader();
      assertEquals(1, reader.numDocs());
      final FieldInfos infos = reader.getFieldInfos();
      assertEquals(DocValuesType.SORTED_SET, infos.fieldInfo("stringdv").getDocValuesType());
      assertEquals(DocValuesType.SORTED_SET, infos.fieldInfo("floatdv").getDocValuesType());
      assertEquals(DocValuesType.SORTED_SET, infos.fieldInfo("intdv").getDocValuesType());

      SortedSetDocValues dv = reader.getSortedSetDocValues("stringdv");
      dv.setDocument(0);
      assertEquals(0, dv.nextOrd());
      assertEquals(1, dv.nextOrd());
      assertEquals(SortedSetDocValues.NO_MORE_ORDS, dv.nextOrd());
    } finally {
      searcherRef.decref();
    }
  } finally {
    core.close();
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:28,代码来源:DocValuesMultiTest.java

示例10: testNonexistantFields

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void testNonexistantFields() throws Exception {
  Directory dir = newDirectory();
  RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
  Document doc = new Document();
  iw.addDocument(doc);
  DirectoryReader ir = iw.getReader();
  iw.close();
  
  AtomicReader ar = getOnlySegmentReader(ir);
  
  final FieldCache cache = FieldCache.DEFAULT;
  cache.purgeAllCaches();
  assertEquals(0, cache.getCacheEntries().length);
  
  Bytes bytes = cache.getBytes(ar, "bogusbytes", true);
  assertEquals(0, bytes.get(0));

  Shorts shorts = cache.getShorts(ar, "bogusshorts", true);
  assertEquals(0, shorts.get(0));
  
  Ints ints = cache.getInts(ar, "bogusints", true);
  assertEquals(0, ints.get(0));
  
  Longs longs = cache.getLongs(ar, "boguslongs", true);
  assertEquals(0, longs.get(0));
  
  Floats floats = cache.getFloats(ar, "bogusfloats", true);
  assertEquals(0, floats.get(0), 0.0f);
  
  Doubles doubles = cache.getDoubles(ar, "bogusdoubles", true);
  assertEquals(0, doubles.get(0), 0.0D);
  
  BinaryDocValues binaries = cache.getTerms(ar, "bogusterms", true);
  BytesRef scratch = binaries.get(0);
  assertEquals(0, scratch.length);
  
  SortedDocValues sorted = cache.getTermsIndex(ar, "bogustermsindex");
  assertEquals(-1, sorted.getOrd(0));
  scratch = sorted.get(0);
  assertEquals(0, scratch.length);
  
  SortedSetDocValues sortedSet = cache.getDocTermOrds(ar, "bogusmultivalued");
  sortedSet.setDocument(0);
  assertEquals(SortedSetDocValues.NO_MORE_ORDS, sortedSet.nextOrd());
  
  Bits bits = cache.getDocsWithField(ar, "bogusbits");
  assertFalse(bits.get(0));
  
  // check that we cached nothing
  assertEquals(0, cache.getCacheEntries().length);
  ir.close();
  dir.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:54,代码来源:TestFieldCache.java

示例11: testNonIndexedFields

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void testNonIndexedFields() throws Exception {
  Directory dir = newDirectory();
  RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
  Document doc = new Document();
  doc.add(new StoredField("bogusbytes", "bogus"));
  doc.add(new StoredField("bogusshorts", "bogus"));
  doc.add(new StoredField("bogusints", "bogus"));
  doc.add(new StoredField("boguslongs", "bogus"));
  doc.add(new StoredField("bogusfloats", "bogus"));
  doc.add(new StoredField("bogusdoubles", "bogus"));
  doc.add(new StoredField("bogusterms", "bogus"));
  doc.add(new StoredField("bogustermsindex", "bogus"));
  doc.add(new StoredField("bogusmultivalued", "bogus"));
  doc.add(new StoredField("bogusbits", "bogus"));
  iw.addDocument(doc);
  DirectoryReader ir = iw.getReader();
  iw.close();
  
  AtomicReader ar = getOnlySegmentReader(ir);
  
  final FieldCache cache = FieldCache.DEFAULT;
  cache.purgeAllCaches();
  assertEquals(0, cache.getCacheEntries().length);
  
  Bytes bytes = cache.getBytes(ar, "bogusbytes", true);
  assertEquals(0, bytes.get(0));

  Shorts shorts = cache.getShorts(ar, "bogusshorts", true);
  assertEquals(0, shorts.get(0));
  
  Ints ints = cache.getInts(ar, "bogusints", true);
  assertEquals(0, ints.get(0));
  
  Longs longs = cache.getLongs(ar, "boguslongs", true);
  assertEquals(0, longs.get(0));
  
  Floats floats = cache.getFloats(ar, "bogusfloats", true);
  assertEquals(0, floats.get(0), 0.0f);
  
  Doubles doubles = cache.getDoubles(ar, "bogusdoubles", true);
  assertEquals(0, doubles.get(0), 0.0D);
  
  BinaryDocValues binaries = cache.getTerms(ar, "bogusterms", true);
  BytesRef scratch = binaries.get(0);
  assertEquals(0, scratch.length);
  
  SortedDocValues sorted = cache.getTermsIndex(ar, "bogustermsindex");
  assertEquals(-1, sorted.getOrd(0));
  scratch = sorted.get(0);
  assertEquals(0, scratch.length);
  
  SortedSetDocValues sortedSet = cache.getDocTermOrds(ar, "bogusmultivalued");
  sortedSet.setDocument(0);
  assertEquals(SortedSetDocValues.NO_MORE_ORDS, sortedSet.nextOrd());
  
  Bits bits = cache.getDocsWithField(ar, "bogusbits");
  assertFalse(bits.get(0));
  
  // check that we cached nothing
  assertEquals(0, cache.getCacheEntries().length);
  ir.close();
  dir.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:64,代码来源:TestFieldCache.java

示例12: accumIntervalsMulti

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
private void accumIntervalsMulti(SortedSetDocValues ssdv,
                                 DocIdSetIterator disi, Bits bits) throws IOException {
  // First update the ordinals in the intervals for this segment
  for (FacetInterval interval : intervals) {
    interval.updateContext(ssdv);
  }

  int doc;
  while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
    if (bits != null && bits.get(doc) == false) {
      continue;
    }
    ssdv.setDocument(doc);
    long currOrd;
    int currentInterval = 0;
    while ((currOrd = ssdv.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
      boolean evaluateNextInterval = true;
      while (evaluateNextInterval && currentInterval < intervals.length) {
        IntervalCompareResult result = intervals[currentInterval].includes(currOrd);
        switch (result) {
          case INCLUDED:
            /*
             * Increment the current interval and move to the next one using
             * the same value
             */
            intervals[currentInterval].incCount();
            currentInterval++;
            break;
          case LOWER_THAN_START:
            /*
             * None of the next intervals will match this value (all of them have 
             * higher start value). Move to the next value for this document. 
             */
            evaluateNextInterval = false;
            break;
          case GREATER_THAN_END:
            /*
             * Next interval may match this value
             */
            currentInterval++;
            break;
        }
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:47,代码来源:IntervalFacets.java

示例13: getSortedSetDocValues

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
@Override
public SortedSetDocValues getSortedSetDocValues(String field) throws IOException {
  final SortedSetDocValues sortedSetDocValues = in.getSortedSetDocValues(field);
  if (sortedSetDocValues == null) {
    return null;
  }
  return new SortedSetDocValues() {

    private boolean _access;

    @Override
    public void setDocument(int docID) {
      try {
        if (_access = _accessControl.hasAccess(ReadType.SORTED_SET_DOC_VALUE, docID)) {
          sortedSetDocValues.setDocument(docID);
        }
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }

    @Override
    public long nextOrd() {
      if (_access) {
        return sortedSetDocValues.nextOrd();
      }
      return NO_MORE_ORDS;
    }

    @Override
    public void lookupOrd(long ord, BytesRef result) {
      if (_access) {
        sortedSetDocValues.lookupOrd(ord, result);
      } else {
        result.bytes = BinaryDocValues.MISSING;
        result.length = 0;
        result.offset = 0;
      }
    }

    @Override
    public long getValueCount() {
      return sortedSetDocValues.getValueCount();
    }
  };
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:47,代码来源:SecureAtomicReader.java

示例14: testNonexistantFields

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void testNonexistantFields() throws Exception {
  Directory dir = newDirectory();
  RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
  Document doc = new Document();
  iw.addDocument(doc);
  DirectoryReader ir = iw.getReader();
  iw.close();
  
  AtomicReader ar = getOnlySegmentReader(ir);
  
  final FieldCache cache = FieldCache.DEFAULT;
  cache.purgeAllCaches();
  assertEquals(0, cache.getCacheEntries().length);
  
  Bytes bytes = cache.getBytes(ar, "bogusbytes", true);
  assertEquals(0, bytes.get(0));

  Shorts shorts = cache.getShorts(ar, "bogusshorts", true);
  assertEquals(0, shorts.get(0));
  
  Ints ints = cache.getInts(ar, "bogusints", true);
  assertEquals(0, ints.get(0));
  
  Longs longs = cache.getLongs(ar, "boguslongs", true);
  assertEquals(0, longs.get(0));
  
  Floats floats = cache.getFloats(ar, "bogusfloats", true);
  assertEquals(0, floats.get(0), 0.0f);
  
  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);
  assertEquals(0, scratch.length);
  
  SortedSetDocValues sortedSet = cache.getDocTermOrds(ar, "bogusmultivalued");
  sortedSet.setDocument(0);
  assertEquals(SortedSetDocValues.NO_MORE_ORDS, sortedSet.nextOrd());
  
  Bits bits = cache.getDocsWithField(ar, "bogusbits");
  assertFalse(bits.get(0));
  
  // check that we cached nothing
  assertEquals(0, cache.getCacheEntries().length);
  ir.close();
  dir.close();
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:55,代码来源:TestFieldCache.java

示例15: testNonIndexedFields

import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void testNonIndexedFields() throws Exception {
  Directory dir = newDirectory();
  RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
  Document doc = new Document();
  doc.add(new StoredField("bogusbytes", "bogus"));
  doc.add(new StoredField("bogusshorts", "bogus"));
  doc.add(new StoredField("bogusints", "bogus"));
  doc.add(new StoredField("boguslongs", "bogus"));
  doc.add(new StoredField("bogusfloats", "bogus"));
  doc.add(new StoredField("bogusdoubles", "bogus"));
  doc.add(new StoredField("bogusterms", "bogus"));
  doc.add(new StoredField("bogustermsindex", "bogus"));
  doc.add(new StoredField("bogusmultivalued", "bogus"));
  doc.add(new StoredField("bogusbits", "bogus"));
  iw.addDocument(doc);
  DirectoryReader ir = iw.getReader();
  iw.close();
  
  AtomicReader ar = getOnlySegmentReader(ir);
  
  final FieldCache cache = FieldCache.DEFAULT;
  cache.purgeAllCaches();
  assertEquals(0, cache.getCacheEntries().length);
  
  Bytes bytes = cache.getBytes(ar, "bogusbytes", true);
  assertEquals(0, bytes.get(0));

  Shorts shorts = cache.getShorts(ar, "bogusshorts", true);
  assertEquals(0, shorts.get(0));
  
  Ints ints = cache.getInts(ar, "bogusints", true);
  assertEquals(0, ints.get(0));
  
  Longs longs = cache.getLongs(ar, "boguslongs", true);
  assertEquals(0, longs.get(0));
  
  Floats floats = cache.getFloats(ar, "bogusfloats", true);
  assertEquals(0, floats.get(0), 0.0f);
  
  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);
  assertEquals(0, scratch.length);
  
  SortedSetDocValues sortedSet = cache.getDocTermOrds(ar, "bogusmultivalued");
  sortedSet.setDocument(0);
  assertEquals(SortedSetDocValues.NO_MORE_ORDS, sortedSet.nextOrd());
  
  Bits bits = cache.getDocsWithField(ar, "bogusbits");
  assertFalse(bits.get(0));
  
  // check that we cached nothing
  assertEquals(0, cache.getCacheEntries().length);
  ir.close();
  dir.close();
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:65,代码来源:TestFieldCache.java


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