title: Django-haystack full text search working but facets don't
body: <p>Using django-haystack and elasticsearch. Full text search is working ok, but I have
  trouble to implement facets. I've searched tutorial on web but with no success, in other words
  didn't understand any of them. I am beginner in programing, so some help it will be appreciated.
  Thank you in advance. Sorry on my english if isn't good, it isn't my primary language.
  Here is my working full text search.</p>
  
  <p>articles.models.py</p>
  
  <pre><code>class Article(models.Model):
      category =      models.CharField(max_length=60)
      subcategory =   models.CharField(max_length=100)
      name =          models.CharField(max_length=255)
      price =         models.DecimalField(max_digits=8, decimal_places=2)
      pub_date =      models.DateTimeField(auto_now_add=True)
      country =       models.CharField(max_length=60)
      city =          models.CharField(max_length=60)
      # other fields ...
  </code></pre>
  
  <p>12 categories (Vehicles and Parts, Computers and Parts ....)</p>
  
  <p>Subcategories for Vehicles and Parts (Car, Trucks, Bikes, Parts ....)
  I solved this with javascript when submitting form for Article, same for country and city.</p>
  
  <p>articles.search_indexes.py    </p>
  
  <pre><code>class ArticleIndex(indexes.SearchIndex, indexes.Indexable):
      text =          indexes.CharField(document=True, use_template=True)
      subcategory =   indexes.CharField(model_attr='subcategory', faceted=True)
      price =         indexes.DecimalField(model_attr='price', faceted=True)
      pub_date =      indexes.DateTimeField(model_attr='pub_date', faceted=True)
      country =       indexes.CharField(model_attr='country', faceted=True)
      city =          indexes.CharField(model_attr='city', faceted=True)
  
      content_auto = indexes.EdgeNgramField(model_attr='name')
  
      def get_model(self):
          return Article
  
      def index_queryset(self, using=None):
          return self.get_model().objects.all()
  </code></pre>
  
  <p>articles_text</p>
  
  <pre><code>{{ object.name }}
  {{ object.subcategory }}
  {{ object.price }}
  {{ object.pub_date }}
  {{ object.country }}
  {{ object.city }}
  </code></pre>
  
  <p>articles.views.py</p>
  
  <pre><code>def searchArticles(request):
      articles = SearchQuerySet().autocomplete(content_auto=request.POST.get('search_text', ''))
      return render_to_response('ajax_search.html', {'articles': articles})
  </code></pre>
  
  <p>base.html</p>
  
  <pre><code>    {% csrf_token %}
      &lt;input type="text" id="search" class="edo-trazi" name="search" /&gt;
      &lt;ul id="search-results"&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>ajax_search.html</p>
  
  <pre><code>{% if articles.count &gt; 0 %}
  {% for article in articles %}
  &lt;li class="edo-trazi-artikal"&gt;&lt;img class="edo-trazi-slika" src="/static/aktiva/{{ artikal.object.slika }}"/&gt;
  &lt;a class="edo-trazi-ime" href="/artikli/prikazi/{{ artikal.object.id }}/{{ artikal.object.slug }}/"&gt;{{ artikal.object.name }}&lt;/a&gt;   
  {% endfor %}
  {% else %}
  &lt;li&gt;No results!&lt;/li&gt;
  {% endif %}
  </code></pre>
  
  <p>ajax.js</p>
  
  <pre><code>$(function(){
  
  $('#search').keyup(function() {
  
      $.ajax({
          type: "POST",
          url: "/search/",
          data: { 
              'search_text' : $('#search').val(),
              'csrfmiddlewaretoken' : $("input[name=csrfmiddlewaretoken]").val()
          },
          success: searchSuccess,
          dataType: 'html'
      });
  
  });
  
  });
  
  function searchSuccess(data, textStatus, jqXHR)
  {
  $('#search-results').html(data);
  }    
  </code></pre>
  
  <p>project.urls.py</p>
  
  <pre><code>url(r'^search/$', 'articles.views.searchArticles'),
  url(r'^vehicles-parts/', include('vehiclesParts.urls')),
  </code></pre>
  
  <p>Above example code is running ok, if someone is interested in autocomplete I can guide 
  him as much as I know. </p>
  
  <p>vehiclesParts.urls.py</p>
  
  <pre><code>url(r'^$', 'vehiclesParts.views.vehiclesPartsView', name='vehiclesParts'),
  url(r'^search/$', 'vehiclesParts.views.searchVehiclesParts'),
  </code></pre>
  
  <p>vehiclesParts.views.py</p>
  
  <pre><code>def vehiclesPartsView(request):
      return render_to_response('vehiclesParts.html', context_instance=RequestContext(request))
  
  def searchVehiclesParts(request):
      articles = SearchQuerySet().facet('subcategory').facet('price').facet('pub_date').facet('country').facet('city')
      # how to make this code run in similar way like above autocomplete(with ajax), also to 
      # filter results by category "filter (category= 'Vehicles and Parts')", because this
      # advanced search I'll have to do for each category to display and search
      # articles only for that category.
      return render_to_response('ajax-vehiclesParts.html', {'articles': articles})
  </code></pre>
  
  <p>ajax-vehiclesParts.html--Can be same as ajax_search.html I'll just add some additonal fields.
  vehiclesParts.html--How to add facets in template and on selected subcategory or something else to display results in ajax-vehiclesParts.html via Ajax? Also if posible to remember selected subcategory so if next is selected 'city London' or something else to display results only for that subcategory.</p>
  
  <p>ajax-vehiclesParts.js ?????       </p>