Google Groups

Re: [google-appengine] We have an index record for null value?

Jeff Schnitzer Apr 12, 2012 5:09 PM
Posted in group: Google App Engine
Nulls are perfectly reasonable things to index.  Sometimes nulls are
what you want to query for.

What you want is called a 'partial index'.  The facility to do partial
indexes exists in GAE, but how to do it depends on your data access
layer.  Are you python (db or ndb?) or java (jdo/jpa, objectify,

In Objectify-land it looks something like this:

@Index(IfNotNull.class) String name;

You can get effectively the same effect by flagging certain values as
not saved.  But there are so many apis and so many ways to do this
that I wouldn't want to try to list them all here.


On Thu, Apr 12, 2012 at 7:56 PM, David Hardwick
<> wrote:
> And how are you?
> I see records in our custom index for what I know is a null value.  Meaning,
> we index a string field on the model and it needs to be a custom index.
> However, this field is not required to be filled out by the user, and 9
> times out of 10 this field is not filled out by a user...but based on the
> index statistics, I can see that we have an index record regardless if that
> value is filled in or if it is null.  Why write to the index for a null
> value?
> Is this expected behavior and we have to take a custom index approach to not
> get charged index writes for null values?  Or is this a known issues that
> will be addressed at some point?
> Rock on,
>   -Hardwick
> --
> Check out these BetterCloud Products: SherpaTools - DomainWatch - Archive
> Migrator - Google Gooru
> David Hardwick
> CTO,
> BetterCloud
> Mobile: 703-338-0741
> 86 Chambers St. Suite 704
> New York, NY 10007
> (calender availability)
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to
> To unsubscribe from this group, send email to
> For more options, visit this group at