org.elasticsearch.index.query.SourceIntervalsSource Maven / Gradle / Ivy
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
package org.elasticsearch.index.query;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.memory.MemoryIndex;
import org.apache.lucene.queries.intervals.IntervalIterator;
import org.apache.lucene.queries.intervals.IntervalMatchesIterator;
import org.apache.lucene.queries.intervals.IntervalsSource;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryVisitor;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight;
import org.elasticsearch.common.CheckedIntFunction;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
/**
* A wrapper of {@link IntervalsSource} for the case when positions are not indexed.
*/
public final class SourceIntervalsSource extends IntervalsSource {
private final IntervalsSource in;
private final Query approximation;
private final Function, IOException>> valueFetcherProvider;
private final Analyzer indexAnalyzer;
public SourceIntervalsSource(
IntervalsSource in,
Query approximation,
Function, IOException>> valueFetcherProvider,
Analyzer indexAnalyzer
) {
this.in = Objects.requireNonNull(in);
this.approximation = Objects.requireNonNull(approximation);
this.valueFetcherProvider = Objects.requireNonNull(valueFetcherProvider);
this.indexAnalyzer = Objects.requireNonNull(indexAnalyzer);
}
public IntervalsSource getIntervalsSource() {
return in;
}
private LeafReaderContext createSingleDocLeafReaderContext(String field, List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy