Skip to content

Commit

Permalink
Enlève les dépendences à solr/haystack
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Jan 23, 2017
1 parent 598418a commit a73c3e1
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 59 deletions.
1 change: 0 additions & 1 deletion Gulpfile.js
Expand Up @@ -61,7 +61,6 @@ gulp.task('js', () =>
'assets/js/dropdown-menu.js',
'assets/js/editor.js',
'assets/js/featured-resource-preview.js',
'assets/js/find-solved-topics.js',
'assets/js/form-email-username.js',
'assets/js/gallery.js',
'assets/js/jquery-tabbable.js',
Expand Down
15 changes: 0 additions & 15 deletions assets/js/find-solved-topics.js

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Expand Up @@ -8,7 +8,6 @@ elasticsearch-dsl==5.1.0
# Explicit dependencies (references in code)
Django==1.8.16
django-crispy-forms==1.6.0
django-haystack==2.4.1
django-model-utils==2.5
django-munin==0.2.1
python-memcached==1.54
Expand Down
6 changes: 3 additions & 3 deletions templates/forum/topic/new.html
Expand Up @@ -34,11 +34,11 @@


{% block content %}
<div data-solved-topics-url="{% url "forum-complete-topic" %}">
{% crispy form %}
<div>
{% crispy form %}
</div>

{% if form.text.value %}
{% include "misc/previsualization.part.html" with text=form.text.value %}
{% endif %}
{% endblock %}
{% endblock %}
16 changes: 15 additions & 1 deletion update.md
Expand Up @@ -853,7 +853,21 @@ Lancer la commande de calcul des temps de lecture : `python manage.py adjust_nb_
Maj de Raven + releases
-----------------------
Avant de faire le tag des différentes RC, s'assurer qu'un githook a été ajouté comme le propose sentry.
Mettre à jour le `settings_prod.py` en suivant `doc/source/install/configs/settings_prod.py`.
Mettre à jour le `settings_prod.py` :

```diff
+from raven import Client
+from zds.utils.context_processor import get_git_version

# NEVER set this True !!
DEBUG = False

# https://docs.getsentry.com/hosted/clients/python/integrations/django/
RAVEN_CONFIG = {
'dsn': 'to-fill',
+ 'release': get_git_version()
}
```

Elasticsearch (PR #4096)
------------------------
Expand Down
3 changes: 1 addition & 2 deletions zds/forum/urls.py
Expand Up @@ -5,7 +5,7 @@
from zds.forum import feeds
from zds.forum.views import CategoriesForumsListView, CategoryForumsDetailView, ForumTopicsListView, \
TopicPostsListView, TopicNew, TopicEdit, FindTopic, FindTopicByTag, PostNew, PostEdit, \
PostUseful, PostUnread, FindPost, solve_alert, complete_topic, CreateGitHubIssue
PostUseful, PostUnread, FindPost, solve_alert, CreateGitHubIssue

urlpatterns = [

Expand All @@ -29,7 +29,6 @@
url(r'^sujet/(?P<topic_pk>\d+)/(?P<topic_slug>.+)/$', TopicPostsListView.as_view(), name='topic-posts-list'),
url(r'^sujets/membre/(?P<user_pk>\d+)/$', FindTopic.as_view(), name='topic-find'),
url(r'^sujets/tag/(?P<tag_pk>\d+)/(?P<tag_slug>.+)/$', FindTopicByTag.as_view(), name='topic-tag-find'),
url(r'^sujets/recherche/$', complete_topic, name='forum-complete-topic'),

# Message-related
url(r'^message/nouveau/$', PostNew.as_view(), name='post-new'),
Expand Down
25 changes: 0 additions & 25 deletions zds/forum/views.py
Expand Up @@ -18,8 +18,6 @@
from django.views.decorators.http import require_POST, require_GET
from django.views.generic import ListView, DetailView, CreateView, UpdateView
from django.views.generic.detail import SingleObjectMixin
from haystack.inputs import AutoQuery
from haystack.query import SearchQuerySet

from zds.forum.commons import TopicEditMixin, PostEditMixin, SinglePostObjectMixin, ForumEditMixin
from zds.forum.forms import TopicForm, PostForm, MoveTopicForm
Expand Down Expand Up @@ -644,29 +642,6 @@ def solve_alert(request):
return redirect(post.get_absolute_url())


# TODO suggestions de recherche auto lors d'un nouveau topic, cf issues #99 et #580. Actuellement désactivées :(
def complete_topic(request):
if not request.GET.get('q', None):
return HttpResponse('{}', content_type='application/json')

similar_contents = SearchQuerySet().filter(content=AutoQuery(request.GET.get('q'))) \
.order_by('-pubdate').all()

suggestions = {}

counter = 0
for result in similar_contents:
if counter > 5:
break
if 'Topic' in str(result.model) and result.object.is_solved:
suggestions[str(result.object.pk)] = (result.title, result.author, result.object.get_absolute_url())
counter += 1

data = json.dumps(suggestions)

return HttpResponse(data, content_type='application/json')


class CreateGitHubIssue(UpdateView):
queryset = Topic.objects.all()

Expand Down
11 changes: 0 additions & 11 deletions zds/settings.py
Expand Up @@ -163,7 +163,6 @@
'easy_thumbnails',
'easy_thumbnails.optimize',
'crispy_forms',
'haystack',
'munin',
'social.apps.django_app.default',
'rest_framework',
Expand Down Expand Up @@ -342,16 +341,6 @@
PANDOC_LOG = './pandoc.log'
PANDOC_LOG_STATE = False

HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr'
# ...or for multicore...
# 'URL': 'http://127.0.0.1:8983/solr/mysite',
},
}
HAYSTACK_CUSTOM_HIGHLIGHTER = 'zds.utils.highlighter.SearchHighlighter'

ES_ENABLED = True

ES_CONNECTIONS = {
Expand Down

0 comments on commit a73c3e1

Please sign in to comment.