org.elasticsearch.index.fielddata.MultiGeoPointValues Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch Show documentation
Show all versions of elasticsearch Show documentation
Elasticsearch subproject :server
/*
* 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.fielddata;
import org.elasticsearch.common.geo.GeoPoint;
import java.io.IOException;
/**
* A stateful lightweight per document set of {@link GeoPoint} values.
* To iterate over values in a document use the following pattern:
*
* GeoPointValues values = ..;
* values.setDocId(docId);
* final int numValues = values.count();
* for (int i = 0; i < numValues; i++) {
* GeoPoint value = values.valueAt(i);
* // process value
* }
*
* The set of values associated with a document might contain duplicates and
* comes in a non-specified order.
*/
public abstract class MultiGeoPointValues {
/**
* Creates a new {@link MultiGeoPointValues} instance
*/
protected MultiGeoPointValues() {}
/**
* Advance this instance to the given document id
* @return true if there is a value for this document
*/
public abstract boolean advanceExact(int doc) throws IOException;
/**
* Return the number of geo points the current document has.
*/
public abstract int docValueCount();
/**
* Return the next value associated with the current document. This must not be
* called more than {@link #docValueCount()} times.
*
* Note: the returned {@link GeoPoint} might be shared across invocations.
*
* @return the next value for the current docID set to {@link #advanceExact(int)}.
*/
public abstract GeoPoint nextValue() throws IOException;
}