@Column(name = "SP_VALUE", nullable = true) @Field @NumericField @FieldBridge(impl = BigDecimalNumericFieldBridge.class) public BigDecimal myValue;
@Column(name = "SP_VALUE", nullable = true) @Field @NumericField @FieldBridge(impl = BigDecimalNumericFieldBridge.class) public BigDecimal myValue;
@Field(analyze = Analyze.NO, store = Store.YES) @NumericField @SortableField public Float getRating() { return rating; }
@Field(analyze = Analyze.NO, store = Store.YES) @NumericField @SortableField public Float getRating() { return rating; }
@Indexed public class TypeWithSeveralNumericFieldsReferringToSameField { @DocumentId private Integer id; @NumericField(forField = "name") @NumericField(forField = "name") //Intentionally illegal @Field(name = "name") private short name; } }
@Column(name = "pos") @Field(analyze = Analyze.NO) @NumericField @SortableField public int getPosition() { return position; }
@Entity @Indexed private static class EntityWithIncompleteNumericTypeField { @Id @GeneratedValue Long id; @Field(bridge = @FieldBridge(impl = FieldBridgeNotUsingDefaultField.class)) @NumericField // We provide incomplete metadata about the default field: it is numeric, but the exact numeric type is not provided. String numericField; }
@Field(name = ID_SORT) @SortableField(forField = ID_SORT) @NumericField(forField = ID_SORT) public Integer getId() { return id; }
@Indexed public class TypeWithNumericFieldWithoutField { @DocumentId private Integer id; @NumericField private short name; }
@Field(analyzer = @Analyzer(definition = "ngram")) @NumericField(precisionStep = 2) public Float getApproximation() { return approximation; } public void setApproximation(Float approximation) { this.approximation = approximation; }
@Entity @Indexed @Table(name = "ITEM") public static class Item { @Id @GeneratedValue private int id; @Field @NumericField @FieldBridge(impl = BigDecimalNumericFieldBridge.class) private BigDecimal price; public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public int getId() { return id; } }
@Indexed public class TypeWithNumericFieldReferringToNonExistantField { @DocumentId private Integer id; @NumericField(forField = "nonExistant") @Field private short name; }
@Indexed static class TestEntity { @DocumentId public String id; @Field(analyze = Analyze.NO) public String name; @Field(analyze = Analyze.YES) public String description; @Field(analyze = Analyze.NO) @NumericField public int i; @Field(analyze = Analyze.NO) @NumericField public long l; @Field(analyze = Analyze.NO) @NumericField public float f; @Field(analyze = Analyze.NO) @NumericField public double d; } }
@Indexed private static class A { @DocumentId @NumericField @SortableField private Long id; }
@Indexed private static class Score { @DocumentId @NumericField Integer id; @Field(name = "beta", store = Store.YES) Integer subscore; } }
@Indexed private static class Score { @DocumentId @NumericField Integer id; @Field(name = "beta", store = Store.YES) Integer subscore; } }
@Indexed public class Rating { @Field(store = Store.YES) private String agency; @NumericField(forField = "rate") @Field(store = Store.YES) private Double rate; private static final RandomGenerator randomGenerator = RandomGenerator.withDefaults(); public Rating(String agency, Double rate) { this.agency = agency; this.rate = rate; } public static Rating random() { return new Rating( randomGenerator.generateRandomWord(), randomGenerator.randomDouble() ); } @Override public String toString() { return "Rating{" + "agency='" + agency + '\'' + ", rate=" + rate + '}'; } }
@Id @DocumentId @Field( name = "id_forIntegerSort", store = Store.NO, index = Index.NO ) @NumericField @SortableFields({ @SortableField(forField = "id"), @SortableField(forField = "id_forIntegerSort") }) public Integer getId() { return id; }
@Indexed public static class IndexedEntry { @DocumentId int id; @Field(name = "nonMetadataProvidingFieldBridgedNumericField", bridge = @FieldBridge(impl = WrappedDoubleValueNonMetadataProvidingFieldBridge.class)) @NumericField(forField = "nonMetadataProvidingFieldBridgedNumericField") WrappedDoubleValue fieldBridgedNumericField; public IndexedEntry() { } public IndexedEntry(int id) { super(); this.id = id; } public IndexedEntry setUniqueDoubleField(Double uniqueDoubleField) { this.fieldBridgedNumericField = new WrappedDoubleValue( uniqueDoubleField ); return this; } } }
@Indexed public class Staff { @DocumentId @NumericField(forField = "id") @Field(name = "idSort") @SortableField(forField = "idSort") final Long id; @Field(store = Store.YES) final String name; Staff(long id, String name) { this.id = id; this.name = name; } }