I have a Django-oscar shop and I successfully installed Solr 4.7.2 as search engine. It works great with the predefined attributes, e.g. upc, title, product_class...
But filtering for additional attributes did not work.
Thats my catalogue/models.py:
class Product(AbstractProduct):
video_url = models.URLField()
co2 = models.IntegerField()
is_public = models.BooleanField()
test = models.TextField()
In search_indexes.py, I tried to add something like:
co2 = indexes.IntegerField(model_attr="co2", null=True, indexed=False)
def prepare_co2(self, obj):
return self.apps.get_model().objects.filter(co2="2")
# return obj.co2 etc. here I tried a lot of code, but didnt work
I also tried to copy the ready-made code for this function.
Has anyone an idea, how to do that? When I filter for catalogue.products.title it works fine but not with cataolgue.products.co2 (which I have suplemented myself).
It was a problem with my django-oscar version. I updated it and now I can successfully reindex the schema.xml.