0

GAE model properties can be removed from built-in index by setting "indexed" to false.

In DjangoAppEngine, I don't see an API to set model fields to not be indexed. How do I set a model field as such?

jacob
  • 2,762
  • 1
  • 20
  • 49

1 Answers1

1

Per the excellent documentation you would use 'unindexed' as explained here:
http://djangoappengine.readthedocs.org/en/latest/db.html#indexes

In case you prefer not to follow the link here's a code-sample:

from myapp.models import MyContact

FIELD_INDEXES = {
    MyContact: {
        'indexed': [...],
        'unindexed': ['creation_date', 'last_modified', ...],
    },
}
mechanical_meat
  • 163,903
  • 24
  • 228
  • 223
  • Actually I have one other question, in case you know: If a field is marked unindexed, can it still be included in a composite index? – jacob Apr 30 '14 at 17:15
  • I don't know. I kinda doubt it. You should test that assumption of mine out though. – mechanical_meat Apr 30 '14 at 17:23
  • 1
    Thanks, I'm planning to test it. – jacob Apr 30 '14 at 17:24
  • Ok, I found out that unindexed property can not be in a composite index. More here: https://code.google.com/p/googleappengine/issues/detail?id=4231 – jacob Apr 30 '14 at 17:33