类org.apache.lucene.search.spans.FilterSpans源码实例Demo

下面列出了怎么用org.apache.lucene.search.spans.FilterSpans的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lucene-solr   文件: SpanPayloadCheckQuery.java
@Override
public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException {
  final PayloadChecker collector = new PayloadChecker();
  Spans matchSpans = matchWeight.getSpans(context, requiredPostings.atLeast(Postings.PAYLOADS));
  return (matchSpans == null) ? null : new FilterSpans(matchSpans) {
    @Override
    protected AcceptStatus accept(Spans candidate) throws IOException {
      collector.reset();
      candidate.collect(collector);
      return collector.match();
    }
  };
}
 
@Override
public Spans getSpans(final LeafReaderContext context, Postings requiredPostings) throws IOException {
    final PayloadChecker collector = new PayloadChecker();
    Spans matchSpans = matchWeight.getSpans(context, requiredPostings.atLeast(Postings.PAYLOADS));
    return (matchSpans == null) ? null : new FilterSpans(matchSpans) {
        @Override
        protected AcceptStatus accept(Spans candidate) throws IOException {
            collector.reset();
            candidate.collect(collector);
            return collector.match();
        }
    };
}
 
 类所在包
 同包方法