Posts

Showing posts from January, 2018

bash rasbian boring locale warning

to get rid of this warning run those as root echo "LC_ALL=en_US.UTF-8" >> /etc/environment echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen echo "LANG=en_US.UTF-8" > /etc/locale.conf locale-gen en_US.UTF-8

django haystack index update only new items

When solr index becomes bigger, update_index is taking some time and in this period search is returning empty resultset to prevent this basicly you only need to include to the index latest modified records in database. following changes in your model and index structure help you to achieve fast index updates models.py class MyModel ( models . Model ): user = models . ForeignKey ( User ) modified = models . DateTimeField ( auto_now = True ) # add this field to your model search_indexes.py class MyModelIndex ( SearchIndex ): text = CharField ( document = True , use_template = True ) user = CharField ( model_attr = 'user' ) # add this function to your search_indexes.py def get_updated_field ( self ): return "modified" ./manage.py update_index --age=110   indexing will run only items updated in the last 110 hours.