Пример #1
0
    def doSearch(self, q, by=['title','searchable_text']):
        """ do they actual search """
        
        catalog = self.getCatalog()
        ok_search_keys = ('id','title','searchable_text')
        if FriedUtils.same_type(by, 's'):
            by = [by]

        by = [x for x in by if x in ok_search_keys]

        if not by:
            return []

        try:
            brains = []
            for searchkey in by:
                brains += apply(catalog.searchResults, (), {searchkey:q})

        except Exception, m:
            self.REQUEST.set('SEARCH_ERROR',m)
            LOG("%s.Homepage" % self.ProjectName(), INFO, "doSearch() error",
                error=sys.exc_info())
            return []