Mercurial > public > sg101
annotate custom_search/tasks.py @ 943:cf9918328c64
Haystack tweaks for Django 1.7.7.
I had to upgrade to Haystack 2.3.1 to get it to work with Django
1.7.7. I also had to update the Xapian backend. But I ran into
problems.
On my laptop anyway (Ubuntu 14.0.4), xapian gets mad when search terms
are greater than 245 chars (or something) when indexing. So I created
a custom field that would simply omit terms greater than 64 chars and
used this field everywhere I previously used a CharField.
Secondly, the custom search form was broken now. Something changed in
the Xapian backend and exact searches stopped working. Fortunately the
auto_query (which I was using originally and broke during an upgrade)
started working again. So I cut the search form back over to doing an
auto_query. I kept the form the same (3 fields) because I didn't want
to change the form and I think it's better that way.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 13 May 2015 20:25:07 -0500 |
parents | f97dd33ca52d |
children |
rev | line source |
---|---|
bgneal@525 | 1 """ |
bgneal@525 | 2 Tasks for our custom search application. |
bgneal@525 | 3 |
bgneal@525 | 4 """ |
bgneal@750 | 5 from __future__ import absolute_import |
bgneal@750 | 6 |
bgneal@750 | 7 from celery import shared_task |
bgneal@755 | 8 from celery.utils.log import get_task_logger |
bgneal@726 | 9 from django.conf import settings |
bgneal@525 | 10 |
bgneal@525 | 11 from queued_search.management.commands.process_search_queue import Command |
bgneal@525 | 12 |
bgneal@755 | 13 logger = get_task_logger(__name__) |
bgneal@755 | 14 |
bgneal@525 | 15 |
bgneal@750 | 16 @shared_task |
bgneal@525 | 17 def process_search_queue_task(): |
bgneal@525 | 18 """ |
bgneal@525 | 19 Celery task to run the queued_search application's process_search_queue |
bgneal@525 | 20 command. |
bgneal@525 | 21 |
bgneal@525 | 22 """ |
bgneal@726 | 23 if settings.SEARCH_QUEUE_ENABLED: |
bgneal@726 | 24 command = Command() |
bgneal@726 | 25 command.execute() |
bgneal@726 | 26 else: |
bgneal@726 | 27 logger.warning("Search queue disabled; skipping processing") |