Filter null dates in date field

2 views
Skip to first unread message

robinne

unread,
Jul 30, 2010, 9:19:52 PM7/30/10
to Djapian Users
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...
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'
...
Reply all
Reply to author
Forward
0 new messages