nmenego
nmenego

Reputation: 856

Hibernate Search - Compare field to another field in the index

I am looking for a way to compare if two fields match in my index.

I would like to do something like this:

org.apache.lucene.search.Query luceneQuery = qb.keyword().onFields("favourites.dataItem.dataId").matching(<another field>).createQuery();

Can't seem to find it in the official docs. I'd appreciate it if someone can point me in the right direction.

Upvotes: 1

Views: 255

Answers (1)

Hardy
Hardy

Reputation: 19109

You cannot do that in Hibernate Search or Lucene. If I understand correctly you want to know whether a given entity (back by a Lucene Document in the Lucene index) has the same value for two fields. Really, this is much better suited for SQL or a Hibernate Criteria query.

Upvotes: 1

Related Questions