Hi, I've setup a facet for Filter by Price with the following facets:

No Customer Charge
Inquire for Price
< $1,000
$1,001 - $10,000
> $10,000

In the facet block, the facets display out of order like this:

< $1,000 (21)
Inquire for Price (6)
$1,001 - $10,000 (2)
> $10,000 (2)
No Customer Charge (2)

It appears to be descending order based on number of results.

How would I change the order?

Thanks in advance.

Comments

ronan’s picture

Status: Active » Postponed (maintainer needs more info)

I don't actually know I'm afraid. I'm not even sure there's anything my module can do to weight the facets a certain way. My module defines and indexes content against the facets but the rest of the display and handling is done by the ApacheSolr module itself. I can look into it when I have a free moment, but it might be worth asking somebody who works on the ApacheSolr module if there's a way to force the order of facets on your search results.

kevster’s picture

This would also be useful for us - we want to add price facet but cant at the moment due to the ordering...

mtndan’s picture

It appears to be ordering based on number of results returned in a given facet. I dug around and am a bit stumped how to impose an arbitrary order on the facets. I'll post if I find out anything.

mtndan’s picture

It appears to be ordering based on number of results returned in a given facet. I dug around and am a bit stumped how to impose an arbitrary order on the facets. I'll post if I find out anything.

marthinal’s picture

i had the same and i think maybe there are 2 ways:

1.using template_preproccess_block() working with $variables dont know if possible but sure can access to the data from there.
2.into apachesolr.module line 1124(works for me)
switch ($facet_query_sorts[$module][$delta]) {
case 'index numeric asc':
ksort($items, SORT_NUMERIC);
break;
case 'index numeric desc':
krsort($items, SORT_NUMERIC);
break;
case 'index desc':
case 'index key desc':
krsort($items, SORT_STRING);
break;
case 'index asc':
case 'index key asc':
default:
ksort($items, SORT_STRING);
break;
the sort is happening here .Really dont know how you are ordering the content try disabling this snippet ....

Good luck.

marthinal’s picture

I WAS WITH A SMALL NUMBER OF NODES AND NOW !!! DOESNT WORKS!! excuse #5 im working on it ..... ohhh :(

marthinal’s picture

Its not drupal who order the content like this its inside $response ordered.So when we query to solr we have this result . Dont know if possible from solr directly into the query or manipulate the content after into the module in this case apachesolr integration .... someone working on it?

marthinal’s picture

@mtndan
I think we have to open an issue into apachesolr module integration about it maybe ... didnt find anything about it there ...if so please write here the link.

i dont know what to do in this cases if open another with the same name in apachesolr module integration.... and close this one.

marthinal’s picture

I open a issue about it at apachesolr search integration ---> http://drupal.org/node/1057182

brycesenz’s picture

Subscribing.