org.hibernate.search.SearchException: FieldBridge class org.hibernate.search.bridge.String2FieldBridgeAdaptordoes not have a objectToString method: field value in DomainObject

Hibernate JIRA | Brian Langel | 6 years ago
  1. 0

    Hibernate Search tries to guess fieldbridges for unindexed entities

    Stack Overflow | 3 years ago | Rubrick
    org.hibernate.search.SearchException: HSEARCH000135: Unable to guess FieldBridge for <field> in <type>
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    I just tried upgrading everything to the latest version and I ran into this blocker {code} FullTextSession fts = Search.getFullTextSession(getSessionFactory().getCurrentSession()); QueryBuilder qb = fts.getSearchFactory().buildQueryBuilder().forEntity(Usor.class).get(); return (Long) fts.createFullTextQuery(qb.bool() .must( qb.keyword().onField("site.id").ignoreAnalyzer().matching(countrySite.getSite().getId()).createQuery() ) .must( qb.keyword().onField("location.country.countryCode").ignoreAnalyzer().matching(countrySite.getCountry().getCountryCode()).createQuery() ) .must( qb.keyword().onField("role.label").ignoreAnalyzer().matching(UserRole.ROLE_COUNTRYLEADER).createQuery() ).createQuery() ) .setProjection("id") .setResultTransformer(new ProjectionFirstResultTransformer()) .setCacheable(true) .setCacheRegion(CacheRegion.NEVERCHANGE) .uniqueResult(); {code} {noformat} nl.msw.compraventa.exceptions.SearchException: org.hibernate.search.SearchException: Unable to find field role.label in nl.msw.project.model.user.Usor at nl.msw.project.dao.hibernate.SearchFacetDaoHibernate.findUsersByFacet(SearchFacetDaoHibernate.java:702) [...] Caused by: org.hibernate.search.SearchException: Unable to find field role.label in nl.msw.project.model.user.Usor at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.objectToString(DocumentBuilderIndexedEntity.java:681) at org.hibernate.search.query.dsl.impl.FieldContext.objectToString(FieldContext.java:86) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.buildSearchTerm(ConnectedMultiFieldsTermQueryBuilder.java:146) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:100) at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:81) {noformat} Needless to say, this worked in the past. Here's the configuration for the classes in question: {code:title=Usor} @Entity(name = "User2") @Table(name = "User") @org.hibernate.annotations.Table(appliesTo = "User", indexes={ @org.hibernate.annotations.Index(name="passwd",columnNames={"email","password"}) }) @Indexed @FullTextFilterDefs({ @FullTextFilterDef(name="wallFilter",impl=HibernateWallFilterFactory.class) }) @AnalyzerDef(name = "userAnalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters = { @TokenFilterDef(factory = StandardFilterFactory.class), @TokenFilterDef(factory = ASCIIFoldingFilterFactory.class), @TokenFilterDef(factory = LowerCaseFilterFactory.class) }) @NaturalIdCache(region=CacheRegion.NATURAL) @Cache(usage=CacheConcurrencyStrategy.READ_WRITE,region=CacheRegion.USER) public class Usor{ @ManyToMany(cascade=CascadeType.MERGE,fetch = FetchType.LAZY) @JoinTable(name = "User_UserRoles", joinColumns = @JoinColumn(nullable = false), inverseJoinColumns = @JoinColumn(nullable = false)) @Fetch(FetchMode.SUBSELECT) @BatchSize(size=10) @Cache(usage=CacheConcurrencyStrategy.READ_WRITE,region=CacheRegion.USER) @IndexedEmbedded(prefix="role.") @JsonIgnore public Set<UserRole> getRoles() { return roles; } {code} {code:title=UserRole} @Entity @Immutable @Table(name="UserRole") @NaturalIdCache(region=CacheRegion.NATURAL) @Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE,region=CacheRegion.USER) public class UserRole implements Comparable<UserRole>, Serializable,GrantedAuthority, IEntity{ @Column(length=30,nullable=false,unique=true,updatable=false) @NaturalId @Index(name="idxRoleLabel") @Field(index=org.hibernate.search.annotations.Index.YES,store=Store.YES,analyze=Analyze.NO) public String getLabel() { return label; } {code}

    Hibernate JIRA | 3 years ago | Marc Schipperheyn
    nl.msw.compraventa.exceptions.SearchException: org.hibernate.search.SearchException: Unable to find field role.label in nl.msw.project.model.user.Usor
  4. 0

    Mapping abstract classes with includePaths

    Stack Overflow | 4 years ago | Marc
    org.hibernate.search.SearchException: Found invalid @IndexedEmbedded-&gt;paths configured on class nl.project.model.social.AbstractGroup, member language: language.id

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.search.SearchException

      FieldBridge class org.hibernate.search.bridge.String2FieldBridgeAdaptordoes not have a objectToString method: field value in DomainObject

      at org.hibernate.search.engine.DocumentBuilderIndexedEntity.objectToString()
    2. Hibernate Search Engine
      ConnectedMultiFieldsTermQueryBuilder.buildSearchTerm
      1. org.hibernate.search.engine.DocumentBuilderIndexedEntity.objectToString(DocumentBuilderIndexedEntity.java:601)
      2. org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.buildSearchTerm(ConnectedMultiFieldsTermQueryBuilder.java:133)
      2 frames