Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Commit

Permalink
Prevent attempts to index entities with no data (such as deleted enti…
Browse files Browse the repository at this point in the history
…ties)
  • Loading branch information
LordSputnik committed Feb 9, 2016
1 parent 2d2b12e commit ab1cf81
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bbws/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ def reindex_search():

es_conn = Elasticsearch()
for entity in entities:
entity_out = marshal(entity, structures.ENTITY_EXPANDED)
data_out = marshal(entity.master_revision.entity_data,
TYPE_MAP[type(entity)])

entity_out.update(data_out)
index_entity(es_conn, entity_out)
if (entity.master_revision is not None and
entity.master_revision.entity_data is not None):
entity_out = marshal(entity, structures.ENTITY_EXPANDED)
data_out = marshal(entity.master_revision.entity_data,
TYPE_MAP[type(entity)])

entity_out.update(data_out)
index_entity(es_conn, entity_out)

return jsonify({'success': True})

0 comments on commit ab1cf81

Please sign in to comment.