Пример #1
0
    def _get_slice(self, elements: IResultSet, query: IResultSet) -> Iterable:
        """Get slice defined by `query.limit` and `query.offset`.

        :returns: IResultSet if not `query.limit`, else [IResource]
        """
        elements_slice = elements
        if query.limit:
            docids_slice = islice(elements.all(resolve=None), query.offset, query.offset + query.limit)
            elements_slice = [elements.resolver(x) for x in docids_slice]
        return elements_slice
Пример #2
0
    def _get_slice(self, elements: IResultSet, query: IResultSet) -> Iterable:
        """Get slice defined by `query.limit` and `query.offset`.

        :returns: IResultSet if not `query.limit`, else [IResource]
        """
        elements_slice = elements
        if query.limit:
            docids_slice = islice(elements.all(resolve=None), query.offset,
                                  query.offset + query.limit)
            elements_slice = [elements.resolver(x) for x in docids_slice]
        return elements_slice