org.hibernate.search.spatial.impl.SpatialNumericDocValueField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-search-engine Show documentation
Show all versions of hibernate-search-engine Show documentation
Core of the Object/Lucene mapper, query engine and index management
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.search.spatial.impl;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexOptions;
/**
* This class is equivalent to {@code DoubleDocValuesField} except that we set the property indexed to false explicitly.
*
* @see org.apache.lucene.document.DoubleDocValuesField
* @author Davide D'Alto
*/
public class SpatialNumericDocValueField extends Field {
public static final FieldType TYPE = createSpatialFieldType();
private static FieldType createSpatialFieldType() {
FieldType type = new FieldType();
type.setIndexOptions( IndexOptions.NONE );
type.setDocValuesType( DocValuesType.NUMERIC );
type.freeze();
return type;
}
public SpatialNumericDocValueField(String name, Double value) {
super( name, TYPE );
fieldsData = Double.doubleToRawLongBits( value );
}
@Override
public void setDoubleValue(double value) {
super.setLongValue( Double.doubleToRawLongBits( value ) );
}
@Override
public void setLongValue(long value) {
throw new IllegalArgumentException( "cannot change value type from Double to Long" );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy