Hi tried looking for the custom bridges in docs but find really tough to integrate in system.
Looking for Bridges for
1: int and Integer class Bridge
2: long and Long Class Bridge
3: boolean and Boolean Class Bridge
Also for some custom Enum type Bridges.
It would be great if please provide the live example for case where i have to do a search on integer property as below error I got if I wont be able to cast this value from sting to int and at run time.
Servlet.service() for servlet [dispatcherServlet] in context with path [/api] threw exception [Request processing failed; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH400532: Unable to convert DSL parameter: Cannot cast java.lang.String to java.lang.Integer
Context: field ‘salesOrder.items.destinationStationId’] with root cause
java.lang.ClassCastException: Cannot cast java.lang.String to java.lang.Integer
at java.lang.Class.cast(Class.java:3369)
at org.hibernate.search.engine.backend.types.converter.spi.DslConverter.convertUnknown(DslConverter.java:72)
at org.hibernate.search.backend.elasticsearch.types.predicate.impl.ElasticsearchStandardMatchPredicate$Builder.value(ElasticsearchStandardMatchPredicate.java:104)
at org.hibernate.search.engine.search.predicate.dsl.impl.MatchPredicateFieldMoreStepImpl$CommonState.matching(MatchPredicateFieldMoreStepImpl.java:87)
at org.hibernate.search.engine.search.predicate.dsl.impl.MatchPredicateFieldMoreStepImpl.matching(MatchPredicateFieldMoreStepImpl.java:61)
at org.hibernate.search.engine.search.predicate.dsl.MatchPredicateMatchingStep.matching(MatchPredicateMatchingStep.java:33)
Alternatively, you can define a custom bridge to put your numeric data in string fields, with all the downsides this imply: performance, weird results for range queries and sorts, …
Yes, this will compile and run, but you won’t get any match because the field is numeric and you’re trying to execute a string query. The only change here, really, is that Hibernate Search 6 tells you something is wrong instead of ignoring the problem.
I got what you said here instead of making a long or integer range it will do like string range (I faced this issue earlier and now also explaining below)
i.e. if I have amount 430 and if i make a query like 1==>400 it will return result
if i make a query like 1==>1000 it will return null result set.
Now this unexpected behavior is still in the application
Below is details
1: property
2: predicate
3: saving sales amount 4: TestCase non -working
Generic fields of type long are always numeric, there’s nothing more to do.
Honestly, I couldn’t say. There’s simply too many missing pieces of information. Your application is doing tons of things that I don’t see.
This should go without saying, but we have tests for such a simple use cases, and they pass. If you don’t believe me, see this attempt at creating a reproducer.