Esempio n. 1
0
    def __deepcopy__(self, memo):
        cl = self.__class__()

        attrs = utils.save_attrs(self, [
            a for a in self.__dict__
            if a not in ['query', 'hits', 'facets', 'db_fetch', 'cache']
        ])
        utils.load_attrs(cl, attrs)

        if self.db_fetch:
            cl.AttachDBFetch(self.db_fetch)

        if self.facets:
            facets = []
            for f in self.facets:
                attrs = utils.save_attrs(f, [
                    a for a in f.__dict__
                    if a not in ['_db', 'results', 'query']
                ])
                f = Facet(f.name)
                utils.load_attrs(f, attrs)
                facets.append(f)
            cl.AttachFacets(*facets)

        if self.cache:
            cl.AttachCache(self.cache)

        return cl
Esempio n. 2
0
 def __deepcopy__(self, memo):
     cl = self.__class__()
     attrs = utils.save_attrs(self,
         [a for a in self.__dict__ if a not in ['query_handler']])
     utils.load_attrs(cl, attrs)
     if self.query_handler:
         cl.query_handler = bsets.QueryHandler(self.query_handler.computed_index)
     return cl
Esempio n. 3
0
 def __deepcopy__(self, memo):
     cl = self.__class__()
     attrs = utils.save_attrs(
         self, [a for a in self.__dict__ if a not in ['query_handler']])
     utils.load_attrs(cl, attrs)
     if self.query_handler:
         cl.query_handler = bsets.QueryHandler(
             self.query_handler.computed_index)
     return cl
Esempio n. 4
0
    def __deepcopy__(self, memo):
        cl = self.__class__()

        attrs = utils.save_attrs(self,
            [a for a in self.__dict__ if a not in ['query', 'hits', 'facets', 'db_fetch', 'cache']])
        utils.load_attrs(cl, attrs)

        if self.db_fetch:
            cl.AttachDBFetch(self.db_fetch)

        if self.facets:
            facets = []
            for f in self.facets:
                attrs = utils.save_attrs(f,
                    [a for a in f.__dict__ if a not in ['_db', 'results', 'query']])
                f = Facet(f.name)
                utils.load_attrs(f, attrs)
                facets.append(f)
            cl.AttachFacets(*facets)

        if self.cache:
            cl.AttachCache(self.cache)

        return cl
Esempio n. 5
0
 def SaveSphinxOpts():
     return utils.save_attrs(cl, [
         '_offset', '_limit', '_cutoff', '_select', '_groupby',
         '_groupfunc', '_groupsort'
     ])
Esempio n. 6
0
 def SaveSphinxOpts():
     return utils.save_attrs(
         cl, ["_offset", "_limit", "_cutoff", "_select", "_groupby", "_groupfunc", "_groupsort"]
     )