示例#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
示例#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
示例#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
示例#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
示例#5
0
 def SaveSphinxOpts():
     return utils.save_attrs(cl, [
         '_offset', '_limit', '_cutoff', '_select', '_groupby',
         '_groupfunc', '_groupsort'
     ])
示例#6
0
 def SaveSphinxOpts():
     return utils.save_attrs(
         cl, ["_offset", "_limit", "_cutoff", "_select", "_groupby", "_groupfunc", "_groupsort"]
     )