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

Delete index for object #6

Open
emiraga opened this issue Mar 12, 2011 · 0 comments
Open

Delete index for object #6

emiraga opened this issue Mar 12, 2011 · 0 comments

Comments

@emiraga
Copy link

emiraga commented Mar 12, 2011

Just though it might help someone. I modified existing indexed_title_changed. Added new method to class Searchable

def delete_index(self):
    """Remove index entities for this model."""
    klass = StemmedIndex if self.INDEX_STEMMING else LiteralIndex
    query = klass.all(keys_only=True).ancestor(self.key())
    delete_keys = query.fetch(1000)
    db.delete(delete_keys)

When deleting record do this:
p.delete_index()
p.delete()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant