AusDTO / disco_layer

Code, outputs and Information relevant to the discovery layer.
1 stars 5 forks source link

null "depth" field causing SearchFieldError in celery_haystack #82

Closed monkeypants closed 9 years ago

monkeypants commented 9 years ago

Stack-trace example of the error:

[2015-08-07 13:01:47,624: ERROR/Worker-2]  celery_haystack.tasks.CeleryHaystackSignalHandler[b64c4675-178f-460e-b179-8f8d597d0fbb]: The model '<Resource: http://catalogue.nla.gov.au/Record/1541578/Copyright?lookfor=author%3A&max=129&offset=115>' combined with model_attr 'depth' returned None, but doesn't allow a default or null value.
Traceback (most recent call last):
  File "/home/chris/AusDTO/discoveryLayer/.venv/local/lib/python2.7/site-packages/celery_haystack/tasks.py", line 139, in run
    current_index.update_object(instance, using=using)
  File "/home/chris/AusDTO/discoveryLayer/.venv/local/lib/python2.7/site-packages/haystack/indexes.py", line 282, in update_object
    backend.update(self, [instance])
  File "/home/chris/AusDTO/discoveryLayer/.venv/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 166, in update
    prepped_data = index.full_prepare(obj)
  File "/home/chris/AusDTO/discoveryLayer/.venv/local/lib/python2.7/site-packages/haystack/indexes.py", line 212, in full_prepare
    self.prepared_data = self.prepare(obj)
  File "/home/chris/AusDTO/discoveryLayer/.venv/local/lib/python2.7/site-packages/haystack/indexes.py", line 203, in prepare
    self.prepared_data[field.index_fieldname] = field.prepare(obj)
  File "/home/chris/AusDTO/discoveryLayer/.venv/local/lib/python2.7/site-packages/haystack/fields.py", line 230, in prepare
    return self.convert(super(IntegerField, self).prepare(obj))
  File "/home/chris/AusDTO/discoveryLayer/.venv/local/lib/python2.7/site-packages/haystack/fields.py", line 103, in prepare
    raise SearchFieldError("The model '%s' combined with model_attr '%s' returned None, but doesn't allow a default or null value." % (repr(obj), self.model_attr))
SearchFieldError: The model '<Resource: http://catalogue.nla.gov.au/Record/1541578/Copyright?lookfor=author%3A&max=129&offset=115>' combined with model_attr 'depth' returned None, but doesn't allow a default or null value.