Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.
This repository was archived by the owner on Apr 13, 2026. It is now read-only.

Error on prefetch when objects is already deleted, but xapian index not updated, yet #122

@GoogleCodeExporter

Description

@GoogleCodeExporter
When using prefetch and we hit a model object that has been deleted already, 
one get a key error in Djapian. Such a non-existent model object is found, in 
case of an outdated xapian index.

In our case, we call index --rebuild once a day. In between, objects are 
deleted by users. To prevent the subsequent key error in serach results, please 
change the following in ** resultset.py** 

resultset.py, line 150+

for hit in hits:
    try: hit.instance = instances[hit.pk]
    except: self._resultset_cache.remove(hit)

Instead of attaching instances[hit.pk] to hit.instance (which throws the actual 
error), we simply remove this hit from the resultset :)

Cheers,
Simon

Original issue reported on code.google.com by i...@pagewizz.com on 12 Nov 2010 at 6:26

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions