From 4b1ea40ac96c6a6013e46792a3a4b20cc9134b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Fri, 8 Oct 2021 12:44:36 +0200 Subject: [PATCH] HSEARCH-4336 Deprecate the programmatic mapping equivalent of deprecated @Boost annotations --- .../search/cfg/ClassBridgeMapping.java | 7 +++++ .../search/cfg/EntityDescriptor.java | 28 +++++++++++++++++++ .../hibernate/search/cfg/EntityMapping.java | 7 +++++ .../search/cfg/EntitySpatialMapping.java | 7 +++++ .../search/cfg/FieldBridgeMapping.java | 7 +++++ .../hibernate/search/cfg/FieldMapping.java | 7 +++++ .../search/cfg/IndexedClassBridgeMapping.java | 7 +++++ .../hibernate/search/cfg/IndexedMapping.java | 7 +++++ .../search/cfg/PropertyDescriptor.java | 14 ++++++++++ .../search/cfg/PropertySpatialMapping.java | 7 +++++ 10 files changed, 98 insertions(+) diff --git a/engine/src/main/java/org/hibernate/search/cfg/ClassBridgeMapping.java b/engine/src/main/java/org/hibernate/search/cfg/ClassBridgeMapping.java index 27564af1f97..a008ba8ee89 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/ClassBridgeMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/ClassBridgeMapping.java @@ -79,6 +79,13 @@ public ClassBridgeMapping termVector(TermVector termVector) { return this; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public ClassBridgeMapping boost(float boost) { final Map boostAnn = new HashMap(); boostAnn.put( "value", boost ); diff --git a/engine/src/main/java/org/hibernate/search/cfg/EntityDescriptor.java b/engine/src/main/java/org/hibernate/search/cfg/EntityDescriptor.java index a2d720534c6..b737ea6d298 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/EntityDescriptor.java +++ b/engine/src/main/java/org/hibernate/search/cfg/EntityDescriptor.java @@ -91,10 +91,24 @@ public void setCacheInMemory(Map cacheInMemory) { //No-op: this feature is no longer available } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public void setBoost(Map boost) { this.boost = boost; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public Map getBoost() { return boost; } @@ -159,10 +173,24 @@ public Map getProvidedId() { return this.providedId; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public void setDynamicBoost(Map dynamicEntityBoost) { this.dynamicBoost = dynamicEntityBoost; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public Map getDynamicBoost() { return this.dynamicBoost; } diff --git a/engine/src/main/java/org/hibernate/search/cfg/EntityMapping.java b/engine/src/main/java/org/hibernate/search/cfg/EntityMapping.java index 1fd4ea38e31..a5500dcd687 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/EntityMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/EntityMapping.java @@ -36,6 +36,13 @@ public EntitySpatialMapping spatial() { return new EntitySpatialMapping( mapping, entity ); } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public EntityMapping boost(float boost) { final Map boostAnn = new HashMap(); boostAnn.put( "value", boost ); diff --git a/engine/src/main/java/org/hibernate/search/cfg/EntitySpatialMapping.java b/engine/src/main/java/org/hibernate/search/cfg/EntitySpatialMapping.java index 558aa374594..b35bac26b73 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/EntitySpatialMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/EntitySpatialMapping.java @@ -44,6 +44,13 @@ public EntitySpatialMapping store(Store store) { return this; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public EntitySpatialMapping boost(float boost) { final Map boostAnn = new HashMap(); boostAnn.put( "value", boost ); diff --git a/engine/src/main/java/org/hibernate/search/cfg/FieldBridgeMapping.java b/engine/src/main/java/org/hibernate/search/cfg/FieldBridgeMapping.java index b8ce3fa95c1..ca96840d5e8 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/FieldBridgeMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/FieldBridgeMapping.java @@ -63,6 +63,13 @@ public FieldMapping termVector(TermVector termVector) { return fieldMapping.termVector( termVector ); } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public FieldMapping boost(float boost) { return fieldMapping.boost( boost ); } diff --git a/engine/src/main/java/org/hibernate/search/cfg/FieldMapping.java b/engine/src/main/java/org/hibernate/search/cfg/FieldMapping.java index 59ce90625dc..5f2cc328cf3 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/FieldMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/FieldMapping.java @@ -101,6 +101,13 @@ public FieldMapping termVector(TermVector termVector) { return this; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public FieldMapping boost(float boost) { final Map boostAnn = new HashMap(); boostAnn.put( "value", boost ); diff --git a/engine/src/main/java/org/hibernate/search/cfg/IndexedClassBridgeMapping.java b/engine/src/main/java/org/hibernate/search/cfg/IndexedClassBridgeMapping.java index 400406c7d50..5a6ccd41cbb 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/IndexedClassBridgeMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/IndexedClassBridgeMapping.java @@ -81,6 +81,13 @@ public IndexedClassBridgeMapping termVector(TermVector termVector) { return this; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public IndexedClassBridgeMapping boost(float boost) { final Map boostAnn = new HashMap(); boostAnn.put( "value", boost ); diff --git a/engine/src/main/java/org/hibernate/search/cfg/IndexedMapping.java b/engine/src/main/java/org/hibernate/search/cfg/IndexedMapping.java index 7d1b40b960d..d7fec35ebaf 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/IndexedMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/IndexedMapping.java @@ -52,6 +52,13 @@ public IndexedMapping cacheFromIndex(FieldCacheType... type) { return this; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public IndexedMapping boost(float boost) { final Map boostAnn = new HashMap(); boostAnn.put( "value", boost ); diff --git a/engine/src/main/java/org/hibernate/search/cfg/PropertyDescriptor.java b/engine/src/main/java/org/hibernate/search/cfg/PropertyDescriptor.java index a12a3b5e447..6b4b49e7482 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/PropertyDescriptor.java +++ b/engine/src/main/java/org/hibernate/search/cfg/PropertyDescriptor.java @@ -122,10 +122,24 @@ public void setContainedIn(Map containedIn) { this.containedIn = containedIn; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public void setDynamicBoost(Map dynamicBoostAnn) { this.dynamicBoost = dynamicBoostAnn; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public Map getDynamicBoost() { return this.dynamicBoost; } diff --git a/engine/src/main/java/org/hibernate/search/cfg/PropertySpatialMapping.java b/engine/src/main/java/org/hibernate/search/cfg/PropertySpatialMapping.java index d6c059107ea..9eeb9e0d813 100644 --- a/engine/src/main/java/org/hibernate/search/cfg/PropertySpatialMapping.java +++ b/engine/src/main/java/org/hibernate/search/cfg/PropertySpatialMapping.java @@ -46,6 +46,13 @@ public PropertySpatialMapping store(Store store) { return this; } + /** + * @deprecated Index-time boosting will not be possible anymore starting from Lucene 7. + * You should use query-time boosting instead, for instance by calling + * {@link org.hibernate.search.query.dsl.FieldCustomization#boostedTo(float) boostedTo(float)} + * when building queries with the Hibernate Search query DSL. + */ + @Deprecated public PropertySpatialMapping boost(float boost) { final Map boostAnn = new HashMap(); boostAnn.put( "value", boost );