python - Haystack: stats() and stats_results() doesn't work -
i have following problem haystack , django. trying filter model books objects , max , min price. bellow query, sq dynamically generated query:
partial_query = searchqueryset().models(books).filter(sq)
this return 10 results. after checked documentation of haystack (http://django-haystack.readthedocs.org/en/latest/searchqueryset_api.html), found stats('price'), stats_results() work fine me, reason, output see none. below code:
partial_query = searchqueryset().models(listing).filter(sq).stats('price') partial_query.stats_results()
after few test, found following print that, expect do.
print(partial_query[0].price) #for example 123 print(partial_query) #list 10 objects
also if know other methods max , min price query, please feel free share me :). grateful help. thanks.
from tags sounds you're using elasticsearch per haystack documentation
this supported on solr only.
Comments
Post a Comment