Permalink
Browse files

(hopefully) removed all traces of haystack.

  • Loading branch information...
fwenzel committed Jul 5, 2010
1 parent 3b32cbb commit 1a17b5fd1c1457811b5bd8be49cee2e1b50ac3c4
Showing with 16 additions and 59 deletions.
  1. +14 −4 README.md
  2. +1 −2 apps/search/forms.py
  3. +0 −37 apps/search/search_indexes.py
  4. +0 −4 apps/search/search_sites.py
  5. +0 −4 apps/search/urls.py
  6. +0 −1 requirements/prod.txt
  7. +1 −7 settings.py
View
@@ -29,6 +29,18 @@ to install the required Python libraries.
[virtualenv]: http://pypi.python.org/pypi/virtualenv
+### Sphinx
+
+For searching, we use [Sphinx][sphinx]. Set up an instance of it, and adjust
+the SPHINX\_\* settings in settings.py to match your setup. There are three
+management commands to go with it:
+
+* ``start_sphinx`` starts the sphinx daemon
+* ``stop_sphinx`` stops it
+* ``update_index`` updates the search index (see below)
+
+[sphinx]: http://www.sphinxsearch.com/
+
### Django
Put your database settings in `settings_local.py`:
@@ -59,16 +71,14 @@ and to fetch the initial product details data, run:
./manage.py update_product_details
-Finally, to initialize the [search index][Haystack], run:
+Finally, to initialize the search index, run:
- ./manage.py rebuild_index
+ ./manage.py update_index
The Internet has plenty of of documentation on setting up a Django application
with any web server. If you need a wsgi entry point, you can find one in
``wsgi/reporter.wsgi``.
-[Haystack]: http://haystacksearch.org/
-
### Cron jobs
There are two jobs you want to run periodically:
View
@@ -1,7 +1,6 @@
from datetime import date, timedelta
from django import forms
-from haystack.forms import SearchForm
import product_details
from feedback import APPS, FIREFOX, OS_USAGE, LATEST_BETAS
@@ -37,7 +36,7 @@ class SearchInput(forms.TextInput):
input_type = 'search'
-class ReporterSearchForm(SearchForm):
+class ReporterSearchForm(forms.Form):
q = forms.CharField(required=False, label='', widget=SearchInput(
attrs={'placeholder': 'Search Terms'}))
product = forms.ChoiceField(choices=PROD_CHOICES,
@@ -1,37 +0,0 @@
-from urlparse import urlparse
-
-from haystack.indexes import *
-from haystack import site
-
-from feedback.models import Opinion
-
-
-class OpinionIndex(SearchIndex):
- text = CharField(document=True, model_attr='description')
- created = DateTimeField(model_attr='created')
-
- positive = BooleanField(model_attr='positive')
- product = IntegerField(model_attr='product')
- version = CharField(model_attr='version')
- os = CharField(model_attr='os')
- locale = CharField(model_attr='locale')
-
- def prepare_text(self, obj):
- """Include URL parts in searchable text."""
- indexable = [obj.description]
- if obj.url:
- parsed = urlparse(obj.url)
- # Domain
- domain_split = parsed.netloc.split('.')
- if domain_split and domain_split[0] == 'www':
- indexable += domain_split[1:]
- indexable.append('.'.join(domain_split[1:]))
- else:
- indexable += domain_split
- indexable.append(parsed.netloc)
-
- # Path
- indexable += parsed.path.split('/')
- return "\n".join(indexable)
-
-site.register(Opinion, OpinionIndex)
@@ -1,4 +0,0 @@
-import haystack
-
-
-haystack.autodiscover()
View
@@ -1,15 +1,11 @@
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
-from haystack.query import SearchQuerySet
-
from feedback.models import Opinion
import views
-sqs = SearchQuerySet().models(Opinion)
-
urlpatterns = patterns('',
url(r'^$', views.index, name='search'),
)
View
@@ -17,5 +17,4 @@ django-view-cache-utils==0.1.1
topia.termextract==1.1.0
# Search
-django-haystack==1.0.1-final
Whoosh==0.3.18
View
@@ -121,7 +121,6 @@ def JINJA_CONFIG():
'django.contrib.admin',
'annoying',
- 'haystack',
'product_details',
'dashboard',
@@ -133,11 +132,6 @@ def JINJA_CONFIG():
# Where to store product details
PROD_DETAILS_DIR = path('lib/product_details_json')
-# Haystack Search
-HAYSTACK_SITECONF = 'search.search_sites'
-HAYSTACK_SEARCH_ENGINE = 'whoosh'
-HAYSTACK_WHOOSH_PATH = path('lib/whoosh_index')
-
# Setting this to False allows feedback to be collected from any user agent.
# (good for testing)
ENFORCE_USER_AGENT = True
@@ -150,6 +144,7 @@ def JINJA_CONFIG():
MESSAGES_COUNT = 10
TRENDS_COUNT = 10
+# Sphinx Search Index
SPHINX_HOST = '127.0.0.1'
SPHINX_PORT = 3314
SPHINX_SEARCHD = 'searchd'
@@ -158,5 +153,4 @@ def JINJA_CONFIG():
SPHINX_LOG_PATH = path('tmp')
SPHINX_CONFIG_PATH = path('configs/sphinx/sphinx.conf')
-
TEST_RUNNER = 'test_utils.runner.RadicalTestSuiteRunner'

0 comments on commit 1a17b5f

Please sign in to comment.