Example #1
0
 def column_reader(self, fieldname, column=None, reverse=False,
                   translate=True):
     crs = []
     doc_offsets = []
     for i, r in enumerate(self.readers):
         if r.has_column(fieldname):
             cr = r.column_reader(fieldname, column=column, reverse=reverse,
                                  translate=translate)
             crs.append(cr)
             doc_offsets.append(self.doc_offsets[i])
     return columns.MultiColumnReader(crs, doc_offsets)
Example #2
0
    def column_reader(self, fieldname, column):
        if not self.has_column(fieldname):
            raise ValueError("No column %r" % (fieldname, ))

        default = column.default_value()
        colreaders = []
        for r in self._readers:
            if r.has_column(fieldname):
                cr = r.column_reader(fieldname, column)
            else:
                cr = columns.EmptyColumnReader(default, r.doc_count_all())
            colreaders.append(cr)

        if len(colreaders) == 1:
            return colreaders[0]
        else:
            return columns.MultiColumnReader(colreaders)
Example #3
0
    def column_reader(self,
                      fieldname,
                      column=None,
                      reverse=False,
                      translate=True):
        column = column or self.schema[fieldname].column_type
        if not column:
            raise Exception("Field %r has no column type" % (fieldname, ))

        creaders = []
        for r in self.readers:
            cr = r.column_reader(fieldname,
                                 column=column,
                                 reverse=reverse,
                                 translate=translate)
            creaders.append(cr)
        return columns.MultiColumnReader(creaders)
Example #4
0
    def column_reader(self, fieldname, translate=True):
        column = self.schema[fieldname].column_type
        if not column:
            raise Exception("Field %r has no column type" % (fieldname, ))

        default = column.default_value()
        doccount = self.doc_count_all()

        creaders = []
        for r in self.readers:
            if r.has_column(fieldname):
                creaders.append(r.column_reader(fieldname,
                                                translate=translate))
            else:
                creaders.append(columns.EmptyColumnReader(default, doccount))

        return columns.MultiColumnReader(creaders)