java - Indexing an Enum type field with hibernate-search -
i having problems searching using hibernate search when index want use of enum type.
here example of application looks like:
@entity @indexed public class myentity{ @id @field public long id; @field(bridge=@fieldbridge(impl=enumbridge.class)) public flavour flavour; }
with
public enum flavour { vanilla, chocolate, strawberry, pistacchio; }
then try find instances using type of query.
querybuilder qb = [~] ; query q = qb.keyword().onfield("flavour").matching(flavour.vanilla).createquery();
when test results comes empty. tried see content of indexes using luke , not seem find "flavour". re-index after committing changes. everyother type of indexing works , querying works on enum fields.
i have tried combination of norms
, analyze
, index
, store
, ... of @field
annotation (i using hibernate-search 4.5.x hibernate 4.3.1).
what doing wrong? settings should looking at? welcome.
the entity seems store flavour using ordinal (so column flavour contains 0 instead of "vanilla").
i don't know, enumbridge doing, suggest store enumeration string:
@entity @indexed public class myentity{ @id @field public long id; @field(bridge=@fieldbridge(impl=enumbridge.class)) @enumerated(enumtype.string) public flavour flavour; }
Comments
Post a Comment