All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.indexes.serialization.spi.LuceneNumericFieldContext Maven / Gradle / Ivy

There is a newer version: 5.11.12.Final
Show newest version
/*
 * 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.indexes.serialization.spi;

import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexOptions;

/**
 * @author Emmanuel Bernard
 * @author Sanne Grinovero
 */
public class LuceneNumericFieldContext {

	private final FieldType field;
	private final String fieldName;
	private final float fieldBoost;

	public LuceneNumericFieldContext(FieldType field, String fieldName, float fieldBoost) {
		this.field = field;
		this.fieldName = fieldName;
		this.fieldBoost = fieldBoost;
	}

	public String getName() {
		return fieldName;
	}

	public int getPrecisionStep() {
		return field.numericPrecisionStep();
	}

	public SerializableStore getStore() {
		return field.stored() ? SerializableStore.YES : SerializableStore.NO;
	}

	public boolean isIndexed() {
		return field.indexOptions() != IndexOptions.NONE;
	}

	public float getBoost() {
		return fieldBoost;
	}

	public boolean getOmitNorms() {
		return field.omitNorms();
	}

	public boolean getOmitTermFreqAndPositions() {
		return field.indexOptions() == IndexOptions.DOCS;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy