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


Java SortedSetDocValues.NO_MORE_ORDS属性代码示例

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


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

示例1: collect

@Override
public void collect(int doc) throws IOException {
  fromDocTermOrds.setDocument(doc);
  long ord;
  while ((ord = fromDocTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
    int termID = collectedTerms.add(fromDocTermOrds.lookupOrd(ord));
    if (termID < 0) {
      termID = -termID - 1;
    } else {
      if (termID >= scoreSums.length) {
        scoreSums = ArrayUtil.grow(scoreSums);
      }
    }
    
    switch (scoreMode) {
      case Total:
        scoreSums[termID] += scorer.score();
        break;
      case Max:
        scoreSums[termID] = Math.max(scoreSums[termID], scorer.score());
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:TermsWithScoreCollector.java

示例2: collect

@Override
public void collect(int doc) throws IOException {
  fromDocTermOrds.setDocument(doc);
  long ord;
  while ((ord = fromDocTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
    fromDocTermOrds.lookupOrd(ord, scratch);
    
    int termID = collectedTerms.add(scratch);
    if (termID < 0) {
      termID = -termID - 1;
    } else {
      if (termID >= scoreSums.length) {
        scoreSums = ArrayUtil.grow(scoreSums);
      }
    }
    
    switch (scoreMode) {
      case Total:
        scoreSums[termID] += scorer.score();
        break;
      case Max:
        scoreSums[termID] = Math.max(scoreSums[termID], scorer.score());
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:25,代码来源:TermsWithScoreCollector.java

示例3: collect

@Override
public void collect(int doc, long bucket) throws IOException {
    values.setDocument(doc);
    int lo = 0;
    for (long ord = values.nextOrd(); ord != SortedSetDocValues.NO_MORE_ORDS; ord = values.nextOrd()) {
        lo = collect(doc, ord, bucket, lo);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:BinaryRangeAggregator.java

示例4: collect

@Override
public void collect(int doc) throws IOException {
  int groupOrd = groupFieldTermsIndex.getOrd(doc);
  if (facetFieldNumTerms == 0) {
    int segmentGroupedFacetsIndex = groupOrd * (facetFieldNumTerms + 1);
    if (facetPrefix != null || segmentGroupedFacetHits.exists(segmentGroupedFacetsIndex)) {
      return;
    }

    segmentTotalCount++;
    segmentFacetCounts[facetFieldNumTerms]++;

    segmentGroupedFacetHits.put(segmentGroupedFacetsIndex);
    BytesRef groupKey;
    if (groupOrd == -1) {
      groupKey = null;
    } else {
      groupKey = BytesRef.deepCopyOf(groupFieldTermsIndex.lookupOrd(groupOrd));
    }
    groupedFacetHits.add(new GroupedFacetHit(groupKey, null));
    return;
  }

  facetFieldDocTermOrds.setDocument(doc);
  long ord;
  boolean empty = true;
  while ((ord = facetFieldDocTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
    process(groupOrd, (int) ord);
    empty = false;
  }
  
  if (empty) {
    process(groupOrd, facetFieldNumTerms); // this facet ord is reserved for docs not containing facet field.
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:35,代码来源:TermGroupFacetCollector.java

示例5: collect

@Override
public void collect(int doc) throws IOException {
  docTermOrds.setDocument(doc);
  long ord;
  while ((ord = docTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
    final BytesRef term = docTermOrds.lookupOrd(ord);
    collectorTerms.add(term);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:TermsCollector.java

示例6: write

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,代码行数:30,代码来源:SortingResponseWriter.java

示例7: addEdgeIdsToResult

private void addEdgeIdsToResult(int doc) throws IOException {
// set the doc to pull the edges ids for.
docTermOrds.setDocument(doc);
// TODO: why is this final?
BytesRef scratch = new BytesRef();
long ord;
   while ((ord = docTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
      scratch = docTermOrds.lookupOrd(ord);
      // add the edge id to the collector terms.
      // TODO: how do we handle non-string type fields?
      // do i need to worry about that here?
      collectorTerms.add(scratch);
   }
 }
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:14,代码来源:GraphTermsCollector.java

示例8: collect

@Override
public void collect(int doc) throws IOException {
  int groupOrd = groupFieldTermsIndex.getOrd(doc);
  if (facetFieldNumTerms == 0) {
    int segmentGroupedFacetsIndex = groupOrd * (facetFieldNumTerms + 1);
    if (facetPrefix != null || segmentGroupedFacetHits.exists(segmentGroupedFacetsIndex)) {
      return;
    }

    segmentTotalCount++;
    segmentFacetCounts[facetFieldNumTerms]++;

    segmentGroupedFacetHits.put(segmentGroupedFacetsIndex);
    BytesRef groupKey;
    if (groupOrd == -1) {
      groupKey = null;
    } else {
      groupKey = new BytesRef();
      groupFieldTermsIndex.lookupOrd(groupOrd, groupKey);
    }
    groupedFacetHits.add(new GroupedFacetHit(groupKey, null));
    return;
  }

  facetFieldDocTermOrds.setDocument(doc);
  long ord;
  boolean empty = true;
  while ((ord = facetFieldDocTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
    process(groupOrd, (int) ord);
    empty = false;
  }
  
  if (empty) {
    process(groupOrd, facetFieldNumTerms); // this facet ord is reserved for docs not containing facet field.
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:36,代码来源:TermGroupFacetCollector.java

示例9: collect

@Override
public void collect(int doc) throws IOException {
  docTermOrds.setDocument(doc);
  long ord;
  while ((ord = docTermOrds.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
    docTermOrds.lookupOrd(ord, scratch);
    collectorTerms.add(scratch);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:9,代码来源:TermsCollector.java

示例10: testSingleTermWithOrds

public void testSingleTermWithOrds() throws IOException {
    RandomAccessOrds ords = new RandomAccessOrds() {

        boolean consumed = true;

        @Override
        public void setDocument(int docID) {
            consumed = false;
        }

        @Override
        public long nextOrd() {
            if (consumed) {
                return SortedSetDocValues.NO_MORE_ORDS;
            } else {
                consumed = true;
                return 0;
            }
        }

        @Override
        public BytesRef lookupOrd(long ord) {
            assertEquals(0, ord);
            return new BytesRef("foo");
        }

        @Override
        public long getValueCount() {
            return 1;
        }

        @Override
        public long ordAt(int index) {
            return 0;
        }

        @Override
        public int cardinality() {
            return 1;
        }
    };
    IncludeExclude inexcl = new IncludeExclude(
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))),
            null);
    OrdinalsFilter filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    LongBitSet acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertTrue(acceptedOrds.get(0));

    inexcl = new IncludeExclude(
            new TreeSet<>(Collections.singleton(new BytesRef("bar"))),
            null);
    filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertFalse(acceptedOrds.get(0));

    inexcl = new IncludeExclude(
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))),
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))));
    filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertFalse(acceptedOrds.get(0));

    inexcl = new IncludeExclude(
            null, // means everything included
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))));
    filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertFalse(acceptedOrds.get(0));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:73,代码来源:IncludeExcludeTests.java

示例11: accumIntervalsMulti

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,代码行数:46,代码来源:IntervalFacets.java

示例12: get

@Override
public boolean get(int index) {
  in.setDocument(index);
  return in.nextOrd() != SortedSetDocValues.NO_MORE_ORDS;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:5,代码来源:DocValuesProducer.java


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