İhtiyaç: Filtrede birden fazla seçim yapıldığında bu seçimlerin hangi seçimlere bağımlı olduğunun bulunması.
Çözüm: Seçimi yapılan filtrelerin kırılımları solr facet pivot ile kolayca keşfedilebilir.
Örnek sorgu ve sonucu:
http://localhost:8983/solr/browse?wt=json&facet=true&q=*&facet.pivot.mincount=1&facet.pivot={!key%3Dsize-provider-brand-color}facet_attribute_slug_size,facet_provider_url,facet_brand_model_url,facet_color_url
{"responseHeader":{"status":0,"QTime":1},"response":{"numFound":6,"start":0,"docs":[]},"facet_counts":{"facet_queries":{},"facet_fields":{},"facet_dates":{},"facet_ranges":{},"facet_intervals":{},"facet_pivot":{"size-provider-brand-color":[{"field":"facet_attribute_slug_size","value":"m","count":1,"pivot":[{"field":"facet_provider_url","value":"nautica","count":1,"pivot":[{"field":"facet_brand_model_url","value":"nautica","count":1,"pivot":[{"field":"facet_color_url","value":"gri","count":1}]}]}]}]}}}
Bu gelen sonuçları arka tarafta işleyip istediğiniz gibi kullanabilirsiniz.
Not: Bu tür işlemler ekstra yük getirecektir. Bu nedenle solrconfig.xml dosyanızın içine benzer sorgularda Listener eklemelisiniz. Böylece "Searcher" açıldığında bu sorgu çalıştırılacak ve sorgular önceden çalıştırılmış olduğundan normalden daha hızlı çalışacaktır. Tabii cache ayarlarının da iyi olması gerekiyor.
Örnek:
* /browse sum(product(0.001,score_product_like), product(0.02,score_product_hit), product(0.50, score_provider_boost), product(0.45,score_product_boost), product(0.30, score_provider_boost_cpc), product(0.30, score_provider_boost_cps), product(0.50, score_category_product_boost), product(0.09,score_random), scale(random_1,1,5)) desc true facet_attribute_slug_size,facet_provider_url,facet_brand_model_url,facet_color_url
Kolay gelsin.