-->
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.  [ 6 posts ] 
Author Message
 Post subject: [Hibernate Search] projection problem on null fields
PostPosted: Fri Jun 29, 2007 6:16 am 
Newbie

Joined: Fri Jun 29, 2007 5:01 am
Posts: 12
Hi all,

first: i´m very pleased with hibernate search. nice work.

Hibernate version:
hibernate search beta3
lucene core 2.1.0
jboss 4.2.0.CR2


Probelm:
I use projection to build descriptor objects from the lucene/HS index (saves database roundtrip and is very fast). some of the fields in the index documents have null values. the fields of this values turn out to be null in the retrieved document too.

Stack trace of the resulting NPE:

Caused by: java.lang.NullPointerException
at org.hibernate.search.bridge.TwoWayString2FieldBridgeAdaptor.get(TwoWayString2FieldBridgeAdaptor.java:28)
at org.hibernate.search.engine.DocumentBuilder.populateResult(DocumentBuilder.java:585)
at org.hibernate.search.engine.DocumentBuilder.processFieldsForProjection(DocumentBuilder.java:562)
at org.hibernate.search.engine.DocumentBuilder.getDocumentFields(DocumentBuilder.java:555)
at org.hibernate.search.engine.DocumentExtractor.extract(DocumentExtractor.java:24)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:221)

the root of the problem is (found out after some debugging) that the lucene document object returned form the lucene search does not contain the fields which values are null in the index.

Question:
Is this the expected behavior? When trying to project the fields in the fieldBridge, the document.getField() method returns null (due to the not existing field in the document...).

thanks.


Top
 Profile  
 
 Post subject: additional info
PostPosted: Fri Jun 29, 2007 6:22 am 
Newbie

Joined: Fri Jun 29, 2007 5:01 am
Posts: 12
more info: the code works fine when all fields used in the projecton are indexed with none null values.


Top
 Profile  
 
 Post subject: null values are not stored...
PostPosted: Fri Jun 29, 2007 7:07 am 
Newbie

Joined: Fri Jun 29, 2007 5:01 am
Posts: 12
in fact the index process does not store null values (as mentioned in the documantation).
so a document does not have these fields. the projection should take care of this and return null when failing to find a field in a document... this would make the resulting object[] consistent in length and order.

any comments?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 29, 2007 11:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Yes that's what I had in mind. Apparently my fingers did not obey.
Can you post a JIRA issue (a test case would be cool too)?

_________________
Emmanuel


Top
 Profile  
 
 Post subject: JIRA
PostPosted: Mon Jul 02, 2007 4:55 am 
Newbie

Joined: Fri Jun 29, 2007 5:01 am
Posts: 12
filed JIRA ticket with attached test case:

http://opensource.atlassian.com/project ... HSEARCH-92


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 9:38 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Thanks, it's fixed.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.