first try at haystack + django-taggit

215 views
Skip to first unread message

Dominique Guardiola Falco

unread,
Dec 19, 2011, 4:53:41 AM12/19/11
to django-...@googlegroups.com
I followed the "getting started" documentation and I'm able, with a "simple" backend to search my model

I want now to include the tags from taggit. It's a special case because "tags" is a manager, not a real field
I found Daniel Lindsay answer here : https://groups.google.com/d/topic/django-haystack/aD82EdLZeZw/discussion

======
class EntrySearchIndex(indexes.SearchIndex):
    text = indexes.CharField(document=True, use_template=True)
    # Your fields here, then...
    tags = indexes.MultiValueField()

    def prepare_tags(self, obj):
        return [tag.name for tag in obj.tags.all()]
====

I applied this, and also added : {{ object.tags }} in my model_text.txt template , but the search is still not able to find models using a tag they have

The message was from june 2010, perhaps the API changed meanwhile ?
The proposed method : def prepare_tags looks special : in the official API, I see "prepare", but no mention about specializing the method through its name

What should I do in december 2011 to make this work please ?

Nora Olsen

unread,
Aug 29, 2013, 2:58:42 AM8/29/13
to django-...@googlegroups.com
Curious about this too. Any solution found?

On Friday, May 17, 2013 8:31:25 PM UTC+8, burak.k...@gmail.com wrote:
Have you found a solution on this problem ?

19 Aralık 2011 Pazartesi 11:53:41 UTC+2 tarihinde Bérangère Pasgrandchose yazdı:
Reply all
Reply to author
Forward
0 new messages