The model you want searched needs to subclass Displayable - your Galeria model will do that, since it subclasses Page, which subclasses Displayable, but your Item model does not.
You need to stop and think about what a search result will look like and actually link to, which is the main idea around search being tied to the Displayable model - Displayable provides a title and url, which search results make use of. You might end up having your Item descriptions somehow feed into a searchable field on your Galeria model, and have it remain the thing that is searched and displayed as a distinct search result. Alternatively, it might be more suitable to make the Item mode subclass Displayable, with each Item having its own title (which would make your "name" field redundant) and url. Perhaps the url field on the Item model isn't strictly necessary, and you'll need to populate it with the parent Galeria instance's url somehow. You'll need to work out which approach best suits your case, and either way you'll probably need to implement some functionality in one of the model's "save" methods in order to populate some data in the other. Good luck! On Tue, Oct 28, 2014 at 5:37 AM, Ernesto Palafox <[email protected]> wrote: > Hi all, im new to mezzanine and I think its awesome. > > I am trying to follow the documentation > http://mezzanine.jupo.org/docs/search-engine.html to made searchable my > custon contentype > > My models.py looks more or less like this: > > > class Galeria(Page): > pass > class Item(models.Model): > > gallery = models.ForeignKey(Galeria, related_name="gallery") > name = models.CharField(max_length=30) > description_1 = RichTextField(blank=True,null=True) > objects = SearchableManager() > search_fields = ("name", "description_1" ) > > > I also have {%search_form "galeria.Item" %}. > > > However, when i try the search, it returns me nothing. ¿What am i doing > wrong? > > > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
