OK, did a little debugging on this. Mezzanine's core app sets the SEARCH_MODEL_CHOICES setting to include "pages.Page" and "blog.BlogPost" as a default (in core/defaults.py). The search method in the SearchableManager class (core/managers.py) will only look for models that subclass "Displayable" if settings.SEARCH_MODEL_CHOICES is not set (Falsy). Therefore to have the Mezzanine search automatically include models that subclass Displayable the SEARCH_MODEL_CHOICES setting would have to be un-set, i.e. in settings.py add SEARCH_MODEL_CHOICES = None
Just posting this in case it's helpful to someone else struggling with this issue. Doug On Saturday, April 5, 2014 2:48:16 PM UTC-5, Doug Evenhouse wrote: > > I've got a couple of custom models that subclass Displayable and, like > Matt, have trouble getting content in these models found by Mezzanine's > search. The only way I can get them found is by setting > SEARCH_MODEL_CHOICES to include my custom models. My expectation, based on > the docs, was that this should be unnecessary. > > Search is working for me now, but wanted to note that there appears to be > an issue here, or at least a disconnect between the docs on the search > engine and actual behavior... Anyone else seeing this? Maybe I'm missing > something. Wouldn't be the first time. > > I am using the latest Django (1.6.2) and Mezzanine (3.0.9). > > Cheers > Doug > > On Sunday, August 11, 2013 4:36:51 PM UTC-5, Matt Mansour wrote: >> >> Ah, simple settings bug on my end. >> >> I was assign to a string instead of a list. >> >> This seems to work. >> >> SEARCH_MODEL_CHOICES = ['myapp.MyModel'] >> >> Thanks for taking a look and helping. >> >> >> On Tuesday, July 30, 2013 1:11:29 PM UTC-7, Matt Mansour wrote: >>> >>> Howdy all - >>> >>> Has anyone come across the following issue in Mezz 1.4.9. >>> >>> Create a model that extends Displayable. Search does not pick up the >>> data. >>> >>> My model has get_absolute_url which works in the templates. My urls.py, >>> views.py (FBVs), and templates, are all straight forward. There is nothing >>> unusual happening. I have not added nor changed search settings in >>> settings.py. >>> >>> Usually when I follow this pattern the models that extend Displayable >>> directly show up in search. I am wondering if anyone else has noticed >>> this. If not then I messed something up. >>> >>> Thanks, >>> Matt >>> >> -- 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.
