We have an index record for null value?

49 views
Skip to first unread message

David Hardwick

unread,
Apr 12, 2012, 7:56:58 PM4/12/12
to google-a...@googlegroups.com
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
tungle.me/davidhardwick (calender availability)




Jeff Schnitzer

unread,
Apr 12, 2012, 8:09:06 PM4/12/12
to google-a...@googlegroups.com
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,
low-level?).

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.

Jeff

> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.

David Hardwick

unread,
Apr 17, 2012, 8:23:30 AM4/17/12
to Google App Engine
Awesome, we are using Objectify!

Many thanks, Jeff! You are a great asset to this list.
Reply all
Reply to author
Forward
0 new messages