Issues
- Unable to extend NumericFieldBridgeHSEARCH-2906Resolved issue: HSEARCH-2906Yoann Rodière
- Incorrect word @FieldBrige in documentationHSEARCH-2903Resolved issue: HSEARCH-2903Sanne Grinovero
- Use of BufferedWriter in GsonEntity may lead to MalformedInputException when input contains 4-byte unicode charactersHSEARCH-2886Resolved issue: HSEARCH-2886Yoann Rodière
- Getting health status fails for non system usersHSEARCH-2883Resolved issue: HSEARCH-2883Sanne Grinovero
- Fix BridgeTest.testCalendarBridgeStringEncoding on PostgreSQLHSEARCH-2879Resolved issue: HSEARCH-2879Yoann Rodière
- Fix AnalyzerInheritanceTest on MariaDBHSEARCH-2878Resolved issue: HSEARCH-2878Yoann Rodière
Unable to extend NumericFieldBridge
Description
Attachments
Details
Assignee
Yoann RodièreYoann RodièreReporter
Leandro Kersting de FreitasLeandro Kersting de FreitasComponents
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Reporter
Components
Fix versions
Affects versions
Priority
Activity
Leandro Kersting de FreitasOctober 4, 2017 at 3:06 AM
Hi,
So we let's wait to update the documentation after 6.x release.
Later I can contribute more with the updates.
Yoann RodièreOctober 3, 2017 at 8:03 AM
Hi ,
Thanks for the report! Yes, it seems we failed to update the documentation a long time ago (https://github.com/hibernate/hibernate-search/commit/46f5f5c70094265e338a76f9725dbbf10a64ad3b, while developing 5.0.0).
The current implementation of BigDecimalFieldBridge (and the one that should be in the documentation) is still in our tests, and it looks a lot like yours (though you dropped the "storeFactor"): https://github.com/hibernate/hibernate-search/blob/6dfbb22d3dc3093f6c4231a7601fc08afc5c1476/engine/src/test/java/org/hibernate/search/test/engine/numeric/BigDecimalNumericFieldBridge.java#L19-L18
If you want to submit a PR, I'll be glad to merge it. I think we should keep the changes to a minimum though, simply updating the code and stating that implementing MetadataProvidingFieldBridge is necessary so that Hibernate Search knows the field should be treated as numeric when querying/sorting. There's a lot more we could improve in the documentation, but we'll have to rewrite a big part of it in 6.0, so any improvement now would be a short-lived one.
Hi,
In the documentation (https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#numeric-field-annotation) we have the example:
Example 27. Defining a custom NumericFieldBridge for BigDecimal
By checking the class (org.hibernate.search.bridge.builtin.NumericFieldBridge), I realized that it is now an 'enum' and the constructor is private respectively.
I believe the documentation is incorrect, or a refactoring made it impossible to extend the class.
Particularly, I'm using with Elasticsearch 5.6 like this:
If it's just the documentation, I can update it. We can even add more examples, such as a custom FieldBridge to a complex enum too.
Test Cases.
TestCase with error: https://github.com/frekele/hibernate-search-elasticsearch-test-case/tree/HSEARCH-2906
Travis CI log: https://travis-ci.org/frekele/hibernate-search-elasticsearch-test-case/builds/282576064
TestCase without error: https://github.com/frekele/hibernate-search-elasticsearch-test-case/tree/HSEARCH-2906-fixed
Travis CI log: https://travis-ci.org/frekele/hibernate-search-elasticsearch-test-case/builds/282577388