title: How to perform full text search in django?
body: <p>For example i have a title <code>How to use User Model in Django</code> and I search with keyword only <code>django</code> then it returns all the titles which has django which is fine but when i enter a keyword like <code>django user model</code> then it returns none.How can I solve this</p>
  
  <p>Any help would be appreciated </p>
  
  <p>views.py</p>
  
  <pre><code>def search_blogs(request):
      q = request.GET.get('q')
      if q:
          blogs = Blog.objects.filter(title__icontains=q).order_by('-created')
          return render(request,'blog/search_blogs.html',{"blogs":blogs,'q':q})
      else:
          messages.error(request,'Please enter some keyword to search')
          return redirect('blog:blogs')
  </code></pre>
  
  <p>template</p>
  
  <pre><code>&lt;form action="{% url 'blog:search_blog' %}" class="search-form"&gt;                
  &lt;input type="text" name="q"  placeholder="Search blogs" align="center" &gt;
   &lt;input type="submit" value="Search" class="btn-sm btn-info &gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>q = request.GET.get('q')
      if q:
          words = request.GET.get('q').split(" ")
          q_filters = Q()
          for word in words:
              q_filters |= Q(title__icontains=word)
  
          blogs = Blog.objects.filter(q_filters)
          return render(request, 'blog/search_blogs.html', {"blogs": blogs, 'q': words})
      else:
          messages.error(request,'Please enter some keyword to search')
          return redirect('blog:blogs')
  </code></pre>
  
  <p>Now in the updated code space is also an input for filter.For example.If I searched <code>user model in django</code> then it returns the other result also which has space but no other title matching only <em>space</em></p>