Thanks for your response.
I was under the impression that the order the queries were placed would be matched up with the order of the classes that appear in the query list.
So for example:
overallQuery.add( submissionBooleanQuery, BooleanClause.Occur.SHOULD );
overallQuery.add( eventBooleanQuery, BooleanClause.Occur.SHOULD );
return ( ( FullTextEntityManager ) em ).createFullTextQuery( overallQuery, Submission.class, EventLang.class );
My expectation here is that the submissionBooleanQuery would only run against the Submission.class and the eventBooleanQuery would only run against the EventLang.class. Based on the behavior this doesn't appear to be the case.
hardy.ferentschik wrote:
Hi,
You could change the field name under which the property 'name' gets indexed. For example, index A.name as nameA and B.name as nameB and change the queries accordingly.
If you don't want to change the field name you could index another unique field for each of the classes. Then add another TermQuery to both submissionQuery and eventBooleanQuery including this field using a BooleanClause.Occur.MUST. In fact, you could use _hibernate_class which already exists. Hibernate uses it to add the class name to the Lucene document. Have a look at the index (using Luke) to see how the documents look like.
However, I would recommend you to rely on intrinsic behaviour of Hibernate Search.
--Hardy