Hi,
as followup to Problem using Multitenancy Discriminator with Hibernate Search - Hibernate Search - Hibernate i tested the Hibernate Search 7 (7.0.0 RC2), but i encounter potentially an other bug.
The massindexer ignores the given tenantId.
E.g: i have 3 tenants “zero” “dummy2” “test” assuming i have 3k rows for test, 0 for zero, 10 for dummy2 and i start the massindexer with the tenant zero
SearchSession searchSession = Search.session(getEntityManager());
searchSession.massIndexer().startAndWait();
When i watch the result in luke i see that the number of documents is 3001 and _HSEARCH_tenantId has a term count of 1 and a freq for zero 3001.
When i search now in my tentant zero and use
result.total().hitCount()
I get value for all hit in all tenants, while
result.hits()
is empty.
When I run the massIndexer again let’s say for tenant “test”. Luke say number of documents 6002 and _HSEARCH_tenantId has a term count of 2 (zero and test) each having freq of 3001.
When i search now on Tenant zero the result is the same.
Conclusion: It seems that the column annotated with @TenantId is ignored while performing a massindex and is treated like a common column. My expected behaviour is that this column will be handled like in the Hibernate ORM (e.g. add a “where TenantIdColumn = ‘MyCurrentTenantId’”)
Hi,
Thanks for reporting but I’m not sure this is enough for us to work on the problem; in particular I’ve learned to not to take what Luke tells us for granted, because it tends to hide some critical information (e.g. docvalues), and is sometimes too low-level (ignores some of the tricks used in Hibernate Search, or uses an incompatible default configuration).
Do you think you could provide a reproducer for this?
There’s a template you can start with here: hibernate-test-case-templates/search/hibernate-search-7/orm-lucene at main · hibernate/hibernate-test-case-templates · GitHub
That’s certainly how it’s intended to work… And how I’ve seen Hibernate Search behave in integration tests so far
Hi,
thx @yrodiere for your response and this template.
i forked your repo and create a test which reproduce my issue.
The behaviour divergent between both test even they should create the same result.
Kind regards
Thanks a lot for the reproducer!
It would seem that in this specific case, Hibernate ORM didn’t apply the filter which it usually applies automatically. Whether because of misuse in Hibernate Search, or a bug/limitation in Hibernate ORM remains to be determined.
I created [HSEARCH-5031] - Hibernate JIRA, we’ll track progress there.
1 Like
Some update: the problem was actually caused by a bug in Hibernate ORM, HHH-17619 , which is going to be solved in Hibernate ORM 6.4.2.
1 Like