Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

(hopefully) removed all traces of haystack.

  • Loading branch information...
commit 1a17b5fd1c1457811b5bd8be49cee2e1b50ac3c4 1 parent 3b32cbb
Fred Wenzel authored July 05, 2010
18  README.md
Source Rendered
@@ -29,6 +29,18 @@ to install the required Python libraries.
29 29
 
30 30
 [virtualenv]: http://pypi.python.org/pypi/virtualenv
31 31
 
  32
+### Sphinx
  33
+
  34
+For searching, we use [Sphinx][sphinx]. Set up an instance of it, and adjust
  35
+the SPHINX\_\* settings in settings.py to match your setup. There are three
  36
+management commands to go with it:
  37
+
  38
+* ``start_sphinx`` starts the sphinx daemon
  39
+* ``stop_sphinx`` stops it
  40
+* ``update_index`` updates the search index (see below)
  41
+
  42
+[sphinx]: http://www.sphinxsearch.com/
  43
+
32 44
 ### Django
33 45
 Put your database settings in `settings_local.py`:
34 46
 
@@ -59,16 +71,14 @@ and to fetch the initial product details data, run:
59 71
 
60 72
     ./manage.py update_product_details
61 73
 
62  
-Finally, to initialize the [search index][Haystack], run:
  74
+Finally, to initialize the search index, run:
63 75
 
64  
-    ./manage.py rebuild_index
  76
+    ./manage.py update_index
65 77
 
66 78
 The Internet has plenty of of documentation on setting up a Django application
67 79
 with any web server. If you need a wsgi entry point, you can find one in
68 80
 ``wsgi/reporter.wsgi``.
69 81
 
70  
-[Haystack]: http://haystacksearch.org/
71  
-
72 82
 ### Cron jobs
73 83
 There are two jobs you want to run periodically:
74 84
 
3  apps/search/forms.py
... ...
@@ -1,7 +1,6 @@
1 1
 from datetime import date, timedelta
2 2
 
3 3
 from django import forms
4  
-from haystack.forms import SearchForm
5 4
 import product_details
6 5
 
7 6
 from feedback import APPS, FIREFOX, OS_USAGE, LATEST_BETAS
@@ -37,7 +36,7 @@ class SearchInput(forms.TextInput):
37 36
     input_type = 'search'
38 37
 
39 38
 
40  
-class ReporterSearchForm(SearchForm):
  39
+class ReporterSearchForm(forms.Form):
41 40
     q = forms.CharField(required=False, label='', widget=SearchInput(
42 41
         attrs={'placeholder': 'Search Terms'}))
43 42
     product = forms.ChoiceField(choices=PROD_CHOICES,
37  apps/search/search_indexes.py
... ...
@@ -1,37 +0,0 @@
1  
-from urlparse import urlparse
2  
-
3  
-from haystack.indexes import *
4  
-from haystack import site
5  
-
6  
-from feedback.models import Opinion
7  
-
8  
-
9  
-class OpinionIndex(SearchIndex):
10  
-    text = CharField(document=True, model_attr='description')
11  
-    created = DateTimeField(model_attr='created')
12  
-
13  
-    positive = BooleanField(model_attr='positive')
14  
-    product = IntegerField(model_attr='product')
15  
-    version = CharField(model_attr='version')
16  
-    os = CharField(model_attr='os')
17  
-    locale = CharField(model_attr='locale')
18  
-
19  
-    def prepare_text(self, obj):
20  
-        """Include URL parts in searchable text."""
21  
-        indexable = [obj.description]
22  
-        if obj.url:
23  
-            parsed = urlparse(obj.url)
24  
-            # Domain
25  
-            domain_split = parsed.netloc.split('.')
26  
-            if domain_split and domain_split[0] == 'www':
27  
-                indexable += domain_split[1:]
28  
-                indexable.append('.'.join(domain_split[1:]))
29  
-            else:
30  
-                indexable += domain_split
31  
-                indexable.append(parsed.netloc)
32  
-
33  
-            # Path
34  
-            indexable += parsed.path.split('/')
35  
-        return "\n".join(indexable)
36  
-
37  
-site.register(Opinion, OpinionIndex)
4  apps/search/search_sites.py
... ...
@@ -1,4 +0,0 @@
1  
-import haystack
2  
-
3  
-
4  
-haystack.autodiscover()
4  apps/search/urls.py
... ...
@@ -1,15 +1,11 @@
1 1
 from django.conf.urls.defaults import *
2 2
 from django.views.generic.simple import direct_to_template
3 3
 
4  
-from haystack.query import SearchQuerySet
5  
-
6 4
 from feedback.models import Opinion
7 5
 
8 6
 import views
9 7
 
10 8
 
11  
-sqs = SearchQuerySet().models(Opinion)
12  
-
13 9
 urlpatterns = patterns('',
14 10
     url(r'^$', views.index, name='search'),
15 11
 )
1  requirements/prod.txt
@@ -17,5 +17,4 @@ django-view-cache-utils==0.1.1
17 17
 topia.termextract==1.1.0
18 18
 
19 19
 # Search
20  
-django-haystack==1.0.1-final
21 20
 Whoosh==0.3.18
8  settings.py
@@ -121,7 +121,6 @@ def JINJA_CONFIG():
121 121
     'django.contrib.admin',
122 122
 
123 123
     'annoying',
124  
-    'haystack',
125 124
     'product_details',
126 125
 
127 126
     'dashboard',
@@ -133,11 +132,6 @@ def JINJA_CONFIG():
133 132
 # Where to store product details
134 133
 PROD_DETAILS_DIR = path('lib/product_details_json')
135 134
 
136  
-# Haystack Search
137  
-HAYSTACK_SITECONF = 'search.search_sites'
138  
-HAYSTACK_SEARCH_ENGINE = 'whoosh'
139  
-HAYSTACK_WHOOSH_PATH = path('lib/whoosh_index')
140  
-
141 135
 # Setting this to False allows feedback to be collected from any user agent.
142 136
 # (good for testing)
143 137
 ENFORCE_USER_AGENT = True
@@ -150,6 +144,7 @@ def JINJA_CONFIG():
150 144
 MESSAGES_COUNT = 10
151 145
 TRENDS_COUNT = 10
152 146
 
  147
+# Sphinx Search Index
153 148
 SPHINX_HOST = '127.0.0.1'
154 149
 SPHINX_PORT = 3314
155 150
 SPHINX_SEARCHD = 'searchd'
@@ -158,5 +153,4 @@ def JINJA_CONFIG():
158 153
 SPHINX_LOG_PATH = path('tmp')
159 154
 SPHINX_CONFIG_PATH = path('configs/sphinx/sphinx.conf')
160 155
 
161  
-
162 156
 TEST_RUNNER = 'test_utils.runner.RadicalTestSuiteRunner'

0 notes on commit 1a17b5f

Please sign in to comment.
Something went wrong with that request. Please try again.