-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: 3.3, why fieldBridge is called during query building
PostPosted: Thu Dec 23, 2010 3:50 pm 
Beginner
Beginner

Joined: Fri Jun 29, 2007 2:19 pm
Posts: 26
Location: Fremont, CA
I recently upgraded to 3.3 and changed all my search queries to use super easy DSL. It failed for me with following exception:

Caused by: org.hibernate.search.SearchException: FieldBridge class org.hibernate.search.bridge.String2FieldBridgeAdaptordoes not have a objectToString method: field user in com.thed.model.ReleaseTestSchedule
at org.hibernate.search.engine.DocumentBuilderIndexedEntity.objectToString(DocumentBuilderIndexedEntity.java:601)
at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.buildSearchTerm(ConnectedMultiFieldsTermQueryBuilder.java:133)
at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:92)
at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:73)

and if I add ignoreFieldBridge, I get NPE
Caused by: java.lang.NullPointerException
at java.io.StringReader.<init>(StringReader.java:33)
at org.hibernate.search.query.dsl.impl.Helper.getAllTermsFromText(Helper.java:76)
at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.getAllTermsFromText(ConnectedMultiFieldsTermQueryBuilder.java:169)
at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:98)
at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsTermQueryBuilder.createQuery(ConnectedMultiFieldsTermQueryBuilder.java:73)

I wonder why FieldBridge getting called during query building. It seems to have changed after 3.2.1

_________________
-shailesh


Top
 Profile  
 
 Post subject: Re: 3.3, why fieldBridge is called during query building
PostPosted: Thu Dec 23, 2010 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
Quote:
I wonder why FieldBridge getting called during query building. It seems to have changed after 3.2.1

of course it changed, there was no DSL at that version, so you where writing Lucene queries directly I guess?

Could you post enough information to reproduce this issue?
I would need to see the annotations on the field and the query you're building, a complete unit test would be great.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: 3.3, why fieldBridge is called during query building
PostPosted: Fri Dec 24, 2010 5:33 am 
Beginner
Beginner

Joined: Fri Jun 29, 2007 2:19 pm
Posts: 26
Location: Fremont, CA
I ll try to upload a full unit test in next few days. Mean while, I try to narrow down the issue, it boils down to having a classBridge on a associated entity (indexed via @indexEmbedded). e.g

Code:
@Entity @Indexed
Class Person{
@IndexedEmbedded
   private PersonDetails details;
}

@ClassBridge(
        name = "personDetailsContents",
        index = Index.TOKENIZED,
        store = Store.YES,
        impl = PersonDetailsClassBridge.class
)
public class PersonDetails{
}


when I comment ClassBridge and remove the details.personDetailsContents from the query, it works fine. What could be wrong with this? Is there any way to disable classBridge?

_________________
-shailesh


Top
 Profile  
 
 Post subject: Re: 3.3, why fieldBridge is called during query building
PostPosted: Thu Dec 30, 2010 5:31 pm 
Beginner
Beginner

Joined: Fri Jun 29, 2007 2:19 pm
Posts: 26
Location: Fremont, CA
I was able to get around this issue by putting ignoreFieldBridge on this field
Code:
name = "personDetailsContents",

Like this:
Code:
...
.should(testcaseQB.keyword().onField("personDetailsContents").ignoreFieldBridge().boostedTo((float) 1).matching(words).createQuery()).createQuery();

_________________
-shailesh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.