Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Nested @IndexEmbedded with indexNullAs ?
PostPosted: Wed Aug 22, 2012 5:57 am 
Newbie

Joined: Wed Aug 22, 2012 5:50 am
Posts: 2
Hi,

I'm trying to index null values of a nested @IndexedEmbedded(indexNullAs = Field.DEFAULT_NULL_TOKEN) @ManyToOne field, in my case its build up as:

Code:
Product.java

@ManyToOne(fetch = FetchType.LAZY)
@IndexedEmbedded()
private ProductCategory productCategory = null;

ProductCategory.java

@ManyToOne()
@IndexedEmbedded(indexNullAs = Field.DEFAULT_NULL_TOKEN)
private Category category = null;


The products do have a productCategory, but in some cases the productCategory.category values are null.

After reindexing and querying using:

Code:
criteria.must(builder.keyword().onField( "productCategory.category" ).ignoreAnalyzer().matching(org.hibernate.search.annotations.Field.DEFAULT_NULL_TOKEN).createQuery()).createQuery();


No results are returned.

Any hints on what may be wrong, or if this is possible ?

Thanks


Top
 Profile  
 
 Post subject: Re: Nested @IndexEmbedded with indexNullAs ?
PostPosted: Fri Aug 24, 2012 11:10 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

on the first glance your code looks fine. I would use Luke to investigate the index and see if the null token gets added. I also would enable debug trace. This will allow you to see log entries for each Document added. This two things should give you an idea where the problem lies.

--Hardy


Top
 Profile  
 
 Post subject: Re: Nested @IndexEmbedded with indexNullAs ?
PostPosted: Sun Aug 26, 2012 1:30 pm 
Newbie

Joined: Wed Aug 22, 2012 5:50 am
Posts: 2
hardy.ferentschik wrote:
Hi,

on the first glance your code looks fine. I would use Luke to investigate the index and see if the null token gets added. I also would enable debug trace. This will allow you to see log entries for each Document added. This two things should give you an idea where the problem lies.

--Hardy


Excellent, didnt knew about Luke yet, thanks. Currently resolved it by filling a dummy string property, but will post any finding resolving it the proper way.

Cheers,
Marius


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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.