To index over a specific tenant you should add the properties of hibernate search of section Entitymanager on your application context, as follow as an example:
<bean depends-on="dataSource" id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="org.hibernate.dialect.SQLServerDialect" />
<property name="generateDdl" value="true"></property>
<property name="showSql" value="true" />
</bean>
</property>
<property name="packagesToScan" value="xxx.xxxx..xxx." />
<property name="persistenceUnitName" value="xxxxxx" />
<property name="dataSource" ref="dataSource" />
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.search.default.directory_provider">filesystem</prop>
<prop key="hibernate.search.default.indexBase">C:\xxxxx\indexes</prop>
</props>
</property>
</bean>
Now you have to use org.hibernate.Session to identify your tenant to perform a search to a specific tenant as follow:
EntityManager manager = managerFactory.createEntityManager();
SessionImpl i = (SessionImpl) manager.getDelegate();
SessionFactory session = i.getSessionFactory();
Session s = session.withOptions().tenantIdentifier(xxxxx).openSession();
FullTextSession fullTextSession = org.hibernate.search.Search.getFullTextSession(s);
return fullTextSession;
This way each search will use a specifc tenant that you provide, but for me seems that you have another problem that is how to get the tenant, in my case I use the url to identify the tenant, if you have anyway that a user choose te tenant to use, get that information in a static variable to use when necessary.