I just need to query if a given value is contained in a list of value. In SQL we simply use the IN operator :
…where entity.id in (1,2,3)
Can we have the same operator for Hibernate search, this allows to less code for us :
For instance :
List<ChoixMentionMicen> unmatchingList = Arrays.asList(ChoixMentionMicen.MENTION_EXECUTOIRE_A_ORDRE, ChoixMentionMicen.MENTION_EXECUTOIRE_NOMINATIVE, ChoixMentionMicen.NOTE_SIMPLE_INFORMATION, ChoixMentionMicen.MENTION_RECTIFICATIVE); PredicateFinalStep b = fa.bool(b0 -> b0.mustNot(fa.match().field(MentionMicen_.NATURE).matching(unmatchingList, ValueConvert.NO)));
Of course, the HSearch gurus gave the solution here :
But I hope that the IN operator should be provided…of course, we could extend this kind of need to be closer to JPA API (coalesce(), between, disjunction, etc.)
Less user code = less bug.