Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix searching blog posts. #32

Closed
wants to merge 1 commit into from

1 participant

@jszakmeister

The search() view was passing STOP_WORDS_RE as a parameter to
re.compile(). Instead, just use STOP_WORDS_RE directly.

@jszakmeister jszakmeister Fix searching blog posts.
The search() view was passing STOP_WORDS_RE as a parameter to
re.compile().  Instead, just use STOP_WORDS_RE directly.
9f57f57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 5, 2011
  1. @jszakmeister

    Fix searching blog posts.

    jszakmeister authored
    The search() view was passing STOP_WORDS_RE as a parameter to
    re.compile().  Instead, just use STOP_WORDS_RE directly.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 2 deletions.
  1. +1 −2  basic/blog/views.py
View
3  basic/blog/views.py
@@ -163,9 +163,8 @@ def search(request, template_name='blog/post_search.html'):
"""
context = {}
if request.GET:
- stop_word_list = re.compile(STOP_WORDS_RE, re.IGNORECASE)
search_term = '%s' % request.GET['q']
- cleaned_search_term = stop_word_list.sub('', search_term)
+ cleaned_search_term = STOP_WORDS_RE.sub('', search_term)
cleaned_search_term = cleaned_search_term.strip()
if len(cleaned_search_term) != 0:
post_list = Post.objects.published().filter(Q(title__icontains=cleaned_search_term) | Q(body__icontains=cleaned_search_term) | Q(tags__icontains=cleaned_search_term) | Q(categories__title__icontains=cleaned_search_term))
Something went wrong with that request. Please try again.