Problem
I try Stored/Indexed Fields(https://django-haystack.readthedocs.org/en/v2.1.0/searchindex_api.html?highlight=load_all%20=%20FALSE#stored-indexed-fields)
In Example,It dosen't hit django db, but my exam hit db.
Example Result
(0.002) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" IN (1); args=(1,)
[23/Oct/2013 08:19:01] "GET /search/?q=shin HTTP/1.1" 200 634
Question
Misunderstanding? Wrong code?
And, I work with tastypie for instant search. So, is there function or option like rendered that not hit db in SearchQuerySet? (http://django-tastypie.readthedocs.org/en/latest/cookbook.html#adding-search-functionality)
search.html
{% for result in page.object_list %}
{{ result.rendered|safe }}
{% endfor %}
user_rendered.txt
<h2>{{ object.username }}</h2>
search_indexes.py
class UserIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
username = indexes.EdgeNgramField(model_attr='username')
email = indexes.CharField(model_attr='email')
# Define the additional field.
rendered = indexes.CharField(use_template=True, indexed=False)
def get_model(self):
return User
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.all()
Please, help me!