solr facet counts not correct with stats and group option

I am using solr search for products-search on our webpage. Since now , all works fine. But while implementing a price slider, to filter actual results by pricerange, I stuck with the following issue:

There is no way to exclude filters for the stats option, same way as it is possible on facets. I use stats for getting the overall min- and max-price, no matter what price range is selected (on the slider) and which category is selected on actual search.

So best way to get this values is to exclude the range-filter on stats select, otherwise there will be max- and min-price just for the actual (ranged) result.

exclude a filter on facets (works on solr 4.4):

...&fq={!tag=cat}categories:Electronics/Computers&facet=true&facet.field={!ex=cat}categories&...

But using this for stats is not possible (see https://issues.apache.org/jira/browse/SOLR-3177)

So then I tried using a group select as suggested on that called page. my solr call looks like this:

fq={!tag=cat}categories:Electronics/Computers&facet=true&
facet.field={!ex=cat}categories_raw&
facet.prefix=Electronics&stats=true&stats.field=minPrice&
stats.field=maxPrice&stats.field=vat&group=true&group.query=minPrice:[* TO 20]
maxPrice:[0 TO *]&group.main=true

All fine. I get the correct stats result and the correct result-count having applied the pricerange-filter. .... EXCEPT the problem, that the facet counts now were wrong, as I did not apply the price range filter.

I know there is a group.facet option, as I also tried. But using that group.facet I need to use a group.field on which the results are based on. In my opinion, usually I need to use the price-field as group.field (group.field=price).

But we do have two price fields on our products (min and max-price). I tried to set them both as group.field parameter, but still get the wrong facet-counts.

It looks like I am just a small step away from the correct solution, but I dont get it.

Any help would be fine.

Answers


Need Your Help

not able to parse json array in php

php json

I have this following php file that is supposed to loop through a json array and print the necessary information. But I am getting an error in browser which i don't know why it is shown."( ! ) Parse

What are the generic ways to make Reporting Services faster

c# optimization reporting-services

While I understand this question is fairly vague since I'm not giving you all as much detail as I'd like to, I'm hoping for some general improvements that can be made to my generation code or the r...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.