def get_filtered_products(self, filters, price_filter, sorting):
        from lfs.catalog.models import Product
        from lfs.catalog.settings import PROPERTY_VALUE_TYPE_FILTER

        products = self.get_all_products()
        if filters:
            # Generate ids for collected products
            product_ids = products.values_list('pk', flat=True)
            product_ids = ", ".join(product_ids)

            # Generate filter
            temp = []
            for f in filters:
                if not isinstance(f[1], (list, tuple)):
                    temp.append("property_id='%s' AND value='%s'" % (f[0], f[1]))
                else:
                    temp.append("property_id='%s' AND value_as_float BETWEEN '%s' AND '%s'" % (f[0], f[1][0], f[1][1]))

            fstr = " OR ".join(temp)

            # TODO: Will this work with every DB?

            # Get all product ids with matching filters. The idea behind this SQL
            # query is: If for every filter (property=value) for a product id exists
            # a "product property value" the product matches.
            cursor = connection.cursor()
            cursor.execute("""
                SELECT product_id, count(*)
                FROM catalog_productpropertyvalue
                WHERE product_id IN (%s) and (%s) and type=%s
                GROUP BY product_id
                HAVING count(*)=%s""" % (product_ids, fstr, PROPERTY_VALUE_TYPE_FILTER, len(filters)))

            matched_product_ids = [row[0] for row in cursor.fetchall()]

            # All variants of category products
            all_variants = Product.objects.filter(parent__in=products)

            if all_variants:
                all_variant_ids = [str(p.id) for p in all_variants]
                all_variant_ids = ", ".join(all_variant_ids)

                # Variants with matching filters
                cursor.execute("""
                    SELECT product_id, count(*)
                    FROM catalog_productpropertyvalue
                    WHERE product_id IN (%s) and %s and type=%s
                    GROUP BY product_id
                    HAVING count(*)=%s""" % (all_variant_ids, fstr, PROPERTY_VALUE_TYPE_FILTER, len(filters)))

                # Get the parent ids of the variants as the "product with variants"
                # should be displayed and not the variants.
                variant_ids = [str(row[0]) for row in cursor.fetchall()]
                if variant_ids:
                    variant_ids = ", ".join(variant_ids)

                    cursor.execute("""
                        SELECT parent_id
                        FROM catalog_product
                        WHERE id IN (%s)""" % variant_ids)

                    parent_ids = [str(row[0]) for row in cursor.fetchall()]
                    matched_product_ids.extend(parent_ids)

            # As we factored out the ids of all matching products now, we get the
            # product instances in the correct order
            products = Product.objects.filter(pk__in=matched_product_ids).distinct()

        if price_filter:
            matched_product_ids = []

            # Get all variants of the products
            variants = Product.objects.filter(parent__in=products)

            # Filter the variants by price
            variants = variants.filter(effective_price__range=[price_filter["min"], price_filter["max"]])

            # Get the parent ids of the variants as the "product with variants"
            # should be displayed and not the variants.
            if variants:
                variant_ids = [str(r.id) for r in variants]
                variant_ids = ", ".join(variant_ids)

                cursor = connection.cursor()
                cursor.execute("""
                    SELECT parent_id
                    FROM catalog_product
                    WHERE id IN (%s)""" % variant_ids)

                parent_ids = [str(row[0]) for row in cursor.fetchall()]
                matched_product_ids.extend(parent_ids)

            # Filter the products
            products = products.filter(effective_price__range=[price_filter["min"], price_filter["max"]])

            # Merge the results
            matched_product_ids.extend(products.values_list('pk', flat=True))

            # And get a new query set of all products
            products = Product.objects.filter(pk__in=matched_product_ids)

        if sorting:
            products = products.order_by(sorting)

        return products
infer the axes of my storer
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manufacturer/models.py/Manufacturer.get_filtered_products--crossover with--dataset/ETHPy150Open pydata/pandas/pandas/io/pytables.py/Fixed.infer_axes