问题
Have Video model and search index for it. Django-haystack and Solr are used. It is needed to sort result by video's views for day/week/month/year. Is it possible to this without always updating of search index by information of views for last day/week/month/year?
If need only sort by view for day and total, then it can be possible update index only for videos viewed for one day, which have current views equal 0.
Using update_index every few hours looks like not good idea, because now it takes 30 min so in future can take much more. Now search index is update only for changed objects with Celery asynchronous task.
回答1:
You might want to take a look at ExternalFileField.
See also http://sujitpal.blogspot.com/2011/05/custom-sorting-in-solr-using-external.html
来源:https://stackoverflow.com/questions/6333067/ordering-solr-search-result-by-day-week-month-year-views