Unable to guess FieldBridge in Search 5.5. Unindexed Fields

2.4k views Asked by At

Versions:

  • Hibernate-Core: 5.2.5.Final
  • Hibernate-Search: 5.5.5.Final

Having the following mappings:

@Indexed
@Entity
@Table(name = "scanresult")
public class ScanResult
{
    @Id
    private ScanResultKey id;

    @Field
    @Column(name = "name")
    private String name;
}

@Embeddable
public class ScanResultKey implements Serializable
{
    @ManyToOne
    @JoinColumn(name = "eA", referencedColumnName = "id")
    private EntityA entA;

    //others...
}

I have read in previous posts that this was an issue in Search 4.4 (when having composite id and foreign relations), but this should be fixed in 5.5. So apparently it is my fault. But I can't figure out what could I do wrong

Exception:

org.hibernate.search.exception.SearchException: HSEARCH000135: Unable to guess FieldBridge for id in entities.keys.ScanResultKey

Note: I only need one field(name) to be indexed

Could you please point out what I'm doing wrong?

1

There are 1 answers

1
Eugene On BEST ANSWER

OK, Since this question got interest near to none, according to view count, here is, briefly, the way I managed (hopefully) to resolve the problem (Please, correct me if you know more)

  • Verify modules' versions compatibility

According to one of the commenters in this SO question, not all (even latest) versions are compatible with each other. For example:

Hibernate Search 5.5 works with Hibernate ORM 5.0.x and 5.1.x (NOT with 5.2.x), and with Apache Lucene 5.3.x, 5.4.x and 5.5.x (Not 6.0)

Stated by: Sanne

This is not a fix to this particular problem, but might save from other issues

  • Create a FieldBridge for Composite Key implementing TwoWayFieldBridge

    public class ScanResultBridge implements TwoWayFieldBridge

  • Add annotation to Entity Class, specifying the implementation of Bridge

    @FieldBridge(impl = ScanResultBridge.class) private ScanResultKey id;