QueryDescriptors ignore targetEntities

Description

I'm porting the following code to take advantage of the Elasticsearch backend and the Lucene query translation:

The migrated version looks like:

This causes NPE when the index manager is not elasticsearch since the LuceneQueryDescriptor does not use the list of indexed classes:

Environment

None

Activity

Show:
Yoann Rodière
October 3, 2016, 10:43 AM

Thank you for this report!

ExtendedSearchIntegrator is part of an implementation package and as such, should not be accessed by user nor service-provider code. Your snippet of code is, in theory, unsupported, since it's making use of ExtendedSearchIntegrator.
If you want to execute this query, you should take advantage of org.hibernate.search.FullTextSession.createFullTextQuery(QueryDescriptor, Class<?>...). You'll have to provide the targeted entities once again, though.

This should incidentally solve the NPE issue. Can you please confirm this?

Now, I agree there still is an issue somewhere, but I think it's more of an API problem here. I have created HSEARCH-2369, and to address those issues.

Gustavo Fernandes
October 3, 2016, 11:01 AM

Hello , unfortunately the FulltextSession is not involved since I am not using ORM, but Integrating Infinispan with Hibernate Search [1] , and that integration essentially creates a query from the SearchFactory. So my PR is just a workaround, but ideally an API should be in place in order to migrate

so that it works both with a Elasticsearch and plain Directory backends, with the lucene query translation working.

[1] https://github.com/infinispan/infinispan/blob/master/query/src/main/java/org/infinispan/query/impl/CacheQueryImpl.java

Fixed

Assignee

Yoann Rodière

Reporter

Gustavo Fernandes

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Major
Configure