Exemplo n.º 1
0
    def values(self, dimension, zipped=False):
        """Return values of search result.

        Attributes:

        * `zipped` - (experimental, might become standard) if ``True`` then
          returns tuples: (`path`, `record`)

        """

        raise NotImplementedError("Fetching values for search matches is not implemented")
        cell = self.browser.full_cube()

        paths = []
        for match in self.matches:
            if match["dimension"] == dimension:
                path_str = match["path"]
                path = cubes.path_from_string(path_str)
                paths.append(path)

        if paths:
            cut = cubes.SetCut(dimension, paths)
            cell.cuts = [cut]
            values = self.browser.values(cell, dimension)
            if zipped:
                # return 0
                return [ {"meta": r[0], "record":r[1]} for r in zip(self.matches, values) ]
            else:
                return values
        else:
            return []
Exemplo n.º 2
0
    def values(self, dimension, zipped=False):
        """Return values of search result.

        Attributes:

        * `zipped` - (experimental, might become standard) if ``True`` then
          returns tuples: (`path`, `record`)

        """

        raise NotImplementedError(
            "Fetching values for search matches is not implemented")
        cell = self.browser.full_cube()

        paths = []
        for match in self.matches:
            if match["dimension"] == dimension:
                path_str = match["path"]
                path = cubes.path_from_string(path_str)
                paths.append(path)

        if paths:
            cut = cubes.SetCut(dimension, paths)
            cell.cuts = [cut]
            values = self.browser.values(cell, dimension)
            if zipped:
                # return 0
                return [{
                    "meta": r[0],
                    "record": r[1]
                } for r in zip(self.matches, values)]
            else:
                return values
        else:
            return []
Exemplo n.º 3
0
    def dimension_matches(self, dimension):
        matches = []
        for match in self.matches:
            if match["dimension"] == dimension:
                dup = dict(match)

                path_str = match["path"]
                path = cubes.path_from_string(path_str)
                dup["path"] = path
                dup["path_string"] = path_str
                matches.append(dup)

        return matches
Exemplo n.º 4
0
    def dimension_matches(self, dimension):
        matches = []
        dim_name = str(dimension)
        for match in self.results:
            if match["dimension"] == dim_name:
                dup = dict(match)

                path_str = match["path"]
                path = cubes.path_from_string(path_str)
                dup["path"] = path
                dup["path_string"] = path_str
                matches.append(dup)

        return matches
Exemplo n.º 5
0
    def dimension_matches(self, dimension):
        matches = []
        if not self.matches:
            return []

        for match in self.matches:
            if match["dimension"] == dimension:
                dup = dict(match)

                path_str = match["path"]
                path = cubes.path_from_string(path_str)
                dup["path"] = path
                dup["path_string"] = path_str
                matches.append(dup)

        return matches