I am trying to develop a filter system using dynamic fields in solr
. These dynamic fields may vary from product to product and have a prefix attribute_filter_
to help me recognize the filter field. So given a search query, I want to get faceted results based on these dynamic fields.
For example, I have 3 products as docs in solr
{ID:1, attribute_filter_color:"white", attribute_filter_brand:"Dell"}
{ID:2, attribute_filter_color:"red", attribute_filter_category:"electronics"}
{ID:3, attribute_filter_size:"mobiles", attribute_filter_brand:"samsung"}
When my search query matches doc 1 and doc2, I want only filters color, brand and category and so facet fields are attribute_filter_color
, attribute_filter_brand
and attribute_filter_category
.
When my search query matches doc 2 and doc3, I want filters color, size, category and brand and so facet fields are attribute_filter_color
, attribute_filter_size
, attribute_filter_category
and attribute_filter_brand
.
When my search query matches doc 1 and doc3, I want filters color, brand and size and so facet fields are attribute_filter_color
,attribute_filter_brand
and attribute_filter_size
.
Also these filters can be ~300 total over 10^5 products. This creates another problem for making a GET URL
with 300 facet fields which might cross the limit for GET URL
.
This jira ticket shows how regex could have helped in this situation.