I have a requirement to do case insensitive text searching. I have the following JP-QL query working well via Hibernate Search:
Code:
@NamedQuery(name = Product.BY_NOMENCLATURE_QUERY,
query = "from Product p join p.brandCodes brandCodes join fetch p.names names where brandCodes in :brandCodes and (p.id like :nomenclature or names like :nomenclature)")
I have the following field indexes confirmed working well with Hibernate Search:
Code:
@ElementCollection(fetch = FetchType.EAGER)
@Field(analyze = Analyze.NO)
@FieldBridge(impl = BuiltinIterableBridge.class)
private Set<String> brandCodes;
@ElementCollection
@MapKeyEnumerated(EnumType.STRING)
@Field(analyze = Analyze.NO)
@FieldBridge(impl = BuiltinMapBridge.class)
private Map<Brand, String> names;
Normally with JP-QL, I could use either the "upper" or "lower" function in the query, and change the case of my named parameter in order to do case-insensitive searching. However, I understand that Hibernate OGM doesn't support JP-QL functions in general. Is there any way to meet my requirement using OGM? Right now, it's looking like my only alternative is to fetch all objects of this entity type from the data store, loop through them all and evaluate which match my search criteria. Since I need to do this for an auto-suggest form, this probably isn't going to be good from performance / resource perspective.