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


Java Filter.getDocIdSet方法代码示例

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


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

示例1: getDISI

import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
private DocIdSetIterator getDISI(Filter filter, AtomicReaderContext context)
    throws IOException {
  // we dont pass acceptDocs, we will filter at the end using an additional filter
  DocIdSet docIdSet = filter.getDocIdSet(context, null);
  if (docIdSet == null) {
    return DocIdSetIterator.empty();
  } else {
    DocIdSetIterator iter = docIdSet.iterator();
    if (iter == null) {
      return DocIdSetIterator.empty();
    } else {
      return iter;
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:ChainedFilter.java

示例2: tstFilterCard

import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
private void tstFilterCard(String mes, int expected, Filter filt)
    throws Exception {
  final DocIdSet docIdSet = filt.getDocIdSet(reader.getContext(), reader.getLiveDocs());
  int actual = 0;
  if (docIdSet != null) {
    DocIdSetIterator disi = docIdSet.iterator();
    while (disi.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
      actual++;
    }
  }
  assertEquals(mes, expected, actual);
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:BooleanFilterTest.java

示例3: getDISI

import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
private static DocIdSetIterator getDISI(Filter filter, AtomicReaderContext context)
    throws IOException {
  // we dont pass acceptDocs, we will filter at the end using an additional filter
  final DocIdSet set = filter.getDocIdSet(context, null);
  return set == null ? null : set.iterator();
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:BooleanFilter.java

示例4: getFilter

import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
@Override
public Filter getFilter(final Filter fastMatchFilter, final ValueSource valueSource) {
  return new Filter() {

    @Override
    public String toString() {
      return "Filter(" + LongRange.this.toString() + ")";
    }

    @Override
    public DocIdSet getDocIdSet(AtomicReaderContext context, final Bits acceptDocs) throws IOException {

      // TODO: this is just like ValueSourceScorer,
      // ValueSourceFilter (spatial),
      // ValueSourceRangeFilter (solr); also,
      // https://issues.apache.org/jira/browse/LUCENE-4251

      final FunctionValues values = valueSource.getValues(Collections.emptyMap(), context);

      final int maxDoc = context.reader().maxDoc();

      final Bits fastMatchBits;
      if (fastMatchFilter != null) {
        DocIdSet dis = fastMatchFilter.getDocIdSet(context, null);
        if (dis == null) {
          // No documents match
          return null;
        }
        fastMatchBits = dis.bits();
        if (fastMatchBits == null) {
          throw new IllegalArgumentException("fastMatchFilter does not implement DocIdSet.bits");
        }
      } else {
        fastMatchBits = null;
      }

      return new DocIdSet() {

        @Override
        public Bits bits() {
          return new Bits() {
            @Override
            public boolean get(int docID) {
              if (acceptDocs != null && acceptDocs.get(docID) == false) {
                return false;
              }
              if (fastMatchBits != null && fastMatchBits.get(docID) == false) {
                return false;
              }
              return accept(values.longVal(docID));
            }

            @Override
            public int length() {
              return maxDoc;
            }
          };
        }

        @Override
        public DocIdSetIterator iterator() {
          throw new UnsupportedOperationException("this filter can only be accessed via bits()");
        }
      };
    }
  };
}
 
开发者ID:europeana,项目名称:search,代码行数:68,代码来源:LongRange.java

示例5: getFilter

import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
@Override
public Filter getFilter(final Filter fastMatchFilter, final ValueSource valueSource) {
  return new Filter() {

    @Override
    public String toString() {
      return "Filter(" + DoubleRange.this.toString() + ")";
    }

    @Override
    public DocIdSet getDocIdSet(AtomicReaderContext context, final Bits acceptDocs) throws IOException {

      // TODO: this is just like ValueSourceScorer,
      // ValueSourceFilter (spatial),
      // ValueSourceRangeFilter (solr); also,
      // https://issues.apache.org/jira/browse/LUCENE-4251

      final FunctionValues values = valueSource.getValues(Collections.emptyMap(), context);

      final int maxDoc = context.reader().maxDoc();

      final Bits fastMatchBits;
      if (fastMatchFilter != null) {
        DocIdSet dis = fastMatchFilter.getDocIdSet(context, null);
        if (dis == null) {
          // No documents match
          return null;
        }
        fastMatchBits = dis.bits();
        if (fastMatchBits == null) {
          throw new IllegalArgumentException("fastMatchFilter does not implement DocIdSet.bits");
        }
      } else {
        fastMatchBits = null;
      }

      return new DocIdSet() {

        @Override
        public Bits bits() {
          return new Bits() {
            @Override
            public boolean get(int docID) {
              if (acceptDocs != null && acceptDocs.get(docID) == false) {
                return false;
              }
              if (fastMatchBits != null && fastMatchBits.get(docID) == false) {
                return false;
              }
              return accept(values.doubleVal(docID));
            }

            @Override
            public int length() {
              return maxDoc;
            }
          };
        }

        @Override
        public DocIdSetIterator iterator() {
          throw new UnsupportedOperationException("this filter can only be accessed via bits()");
        }
      };
    }
  };
}
 
开发者ID:europeana,项目名称:search,代码行数:68,代码来源:DoubleRange.java


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