views:

18

answers:

0

I have a djapian search based on the tutorial that pulls back data from one model. How do I limit results based on date being null or not null (such as DeletedDate). When I delete a record I set DeletedDate=now. I do not want these records returned in my results so I need to filter after the search occurs. I've tried several things with no success. Here is what I think it would be, but I get an error. I don't know if I need the field DeletedDate in the ProductIndexer, just guessing.

class ProductIndexer(Indexer):
    fields = ['Description', 'Keywords', 'Title','DeletedDate']
    space.add_index(Product, ProductIndexer, attach_as='indexer')

... view...

results  = Product.indexer.search(query).prefetch()
#results = results.filter(DeletedDate__isnull=True) #error Unknown field 'DeletedDate__isnull'