def get_models_query(self, query, fields=[], limit=None): mod = site.get_search_model(self.model) if mod: try: hits = utils.search_index(mod, query, fields, limit) except: hits = [] criteria = {'%s__in'%mod.pk: [hit[mod.pk] for hit in hits]} return Q(**criteria) else: return Q()
def rebuild(self): mod = site.get_search_model(self.model) if mod: utils.create_index(mod) utils.update_index(mod)