@GenericField doesn't work as expected

Hi I am trying to migrate from HS5 to HS6 and encounter a strange problem.
I am able to find Strings and Enums using the Annotations FullTextField and KeywordField, but when I am searching for a Integer or Date I am not able to find it (using GenericField annotation).
When I inspect the generated indexes with luke i can see the GenericField names but with a term count 0.
Is there any reason why it works for FullTextField and KeywordField but not for GenericField (i tested it for Fields declared in the same entity or MappedSupperClass)?
(I dropped all HS5 indexes and reindex it with HS6 before and the Indexformat is shown as Lucene 8.6 or later)


Luke only really displays text fields. Hibernate Search 6 indexes integers and dates as numeric fields by default, and only as numeric fields. Hibernate Search 5 could in some cases index them as both text and numeric fields. This explains the difference when inspecting indexes with Luke.

As for why search doesn’t work in your application… you didn’t show your mapping and the code you use when searching, so it’s hard to say. My guess would be you’re trying to run a text-based query on a numeric field, though; that’s a common mistake. Use the Hibernate Search DSL and you won’t have that kind of problems.

Sorry my mapping is way to big :sweat_smile:
Since i had no lead which could be the problem I could provide a minimal example for this.
I use the Hibernate Search DSL did further investigations your are right with luke i was able to find integer values having a term count of 0 in LUKE but unfortunately not all.
I found just found this is my logs but not the details :woozy_face:
HSEARCH700042: 12 failure(s) occurred during mass indexing. See the logs for details. First failure: could not extract ResultSet

The details are further up in your logs.

unfortunately not this message was the only error indicating message in my log.
but i found it.
I made an unintended check to the orm during the upgrade process therefore the orm doesn’t match with the DB. After fixing this it works just as expected. :see_no_evil:

1 Like