-
1. Re: Super class fields not indexed for Hibernate Search
gustavonalle Mar 9, 2016 8:25 AM (in response to vdzhuvinov)Hi, Hibernate Search under Infinispan does not differ when it comes to annotation processing. Is there a reason why entity A is not annotated with @Indexed as well?
-
2. Re: Super class fields not indexed for Hibernate Search
vdzhuvinov Mar 9, 2016 8:46 AM (in response to gustavonalle)Hi Gustavo,
I'll explain why this is so:
The Hibernate Seach docs don't mention that explicitly, however this article (and a few others) say that @Indexed should only be applied to the concrete class that is indexed / stored, whereas any @Field annotations present in super classes should be automatically picked up.
https://dzone.com/articles/hibernate-search-mapping-entit
Just in case, I tried adding @Indexed to the super class, but the exact same exception keeps coming up.
This made me think that Infinispan could be augmenting the default annotation behaviour of Hibernate Search.
-
3. Re: Super class fields not indexed for Hibernate Search
gustavonalle Mar 9, 2016 10:00 AM (in response to vdzhuvinov)What is the Infinispan version and what is the query being done?
-
4. Re: Super class fields not indexed for Hibernate Search
vdzhuvinov Mar 9, 2016 2:03 PM (in response to gustavonalle)Hi,
The test was done with 8.1.2.Final. But we intend to move into 8.2 now that it's released. We really like the new features of 8!
This is the query, where subject is the search argument:
QueryFactory qf = org.infinispan.query.Search.getQueryFactory(cache);
org.infinispan.query.dsl.Query query = qf.from(AuthorizationRecord.class)
.having("subject")
.eq(subject)
.toBuilder()
.build();
return query.list();
-
5. Re: Super class fields not indexed for Hibernate Search
gustavonalle Mar 10, 2016 6:19 AM (in response to vdzhuvinov)It seems the Infinispan native DSL has issues with inheritance. If you try to use a Hibernate Search query, it should work:
SearchManager searchManager = Search.getSearchManager(cache); QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(Child.class).get(); Query luceneQuery = queryBuilder.keyword().onField("subject").matching(subject).createQuery(); CacheQuery cacheQuery = searchManager.getQuery(luceneQuery, Child.class); List<Object> list = cacheQuery.list();
I've created a JIRA to track this: [ISPN-6362] Infinispan Query DSL parser failure with inheritance - JBoss Issue Tracker
-
6. Re: Super class fields not indexed for Hibernate Search
vdzhuvinov Mar 10, 2016 7:06 AM (in response to gustavonalle)Thanks a lot! I can confirm that after switching to the native Hibernate Search query the inheritance of the @Field annotations worked, and all our tests passed.
I was at your JBug talk on v8, and we're now trying out the new features that you presented. In case we encounter problems I'll post here or on the tracker so you can have a chance to make the new bits more stable.