-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to create filter for the field which has no text
PostPosted: Mon Nov 28, 2011 7:15 am 
Newbie

Joined: Mon Nov 28, 2011 3:33 am
Posts: 1
My requirement is, I want to fetch the rows from the table in which for one of the condition is field value should be empty.
I have field to identify record is deleted or not. And if it is deleted we insert date in it. Else field is empty by default.

Now whenever I am issuing facet request it ignores the record for that field as it has no data. Any idea on how can I resolve this?

I tried with something like this in my code to add filter.
Query query = new WildcardQuery(new Term(term,"*"));
return new CachingWrapperFilter( new QueryWrapperFilter(query));

but this will also consider the field which has some text inside it. I want to fetch records only with empty string in the filed. If it has some text then I want to ignore that record.

Any idean on how to achieve this?

Thanks for your help in advance.


Top
 Profile  
 
 Post subject: Re: How to create filter for the field which has no text
PostPosted: Wed Nov 30, 2011 6:01 am 
Hibernate Team
Hibernate Team

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

Having an empty string is probably not such a good idea. Is the field really empty or is it null? If it is null you can have a look at the indexNullAs parameter of the @Field annotation. It allows you to index a arbitrary token for null values.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.