Hi!
I've tried simple and advanced text ranges with last dev version. In both cases the active facet links have class "facetapi-inactive" and the wrong path. They can be only deactivated from current facets block.
For example one facet link has url "http://mysite/catalog/bread/max-baking-weight/%5B0.45%20TO%200.54%5D".
On the page with that path this facet in facet blocks has url "http://2.dev/catalog/bread/max-baking-weight/%5B0.45%20TO%200.54%5D/max-..." and the class "facetapi-inactive". But in the current facets block all urls are fine.

Comments

khiminrm’s picture

Quick and dirty solution
in the file widget_links.inc add lines:

if (isset($e['#path']) && isset($element[$key]['#query']['f'][0]) && substr_count($e['#path'],$element[$key]['#query']['f'][0])>0 ){
         	  $element[$key]['#active'] = TRUE;
		 $element[$key]['#path'] = str_replace('/'.$element[$key]['#query']['f'][0],'',$e['#path']);
		 unset($element[$key]['#query']['f']);
 }

just after:

    // Replace ':' with '/'
    if (module_exists('facetapi_pretty_paths')) {
      foreach($element as $key => $e){
        if (isset($e['#query']['f'])){
          $element[$key]['#query']['f'] = str_replace(':', '/', $e['#query']['f']);
khiminrm’s picture

I've tried without pretty paths module and have no problems. Active facet is correct. Maybe we must reopen https://drupal.org/node/1511144?

khiminrm’s picture

I've tried to modify code in such way:
do not redefine $range_field before
execution of function

search_api_ranges_generate_ranges_simple

or

search_api_ranges_generate_ranges_advanced

After getting $element replace the path and unset $element[$key]['#query']['f'] for the $elements.
All this I've done and the urls are correct, but when I click on facets I get '404'.
Maybe this is not a correct solution and the task is not easy for me. Maybe someone more experienced will help to find the correct way? Thanks!

khiminrm’s picture

StatusFileSize
new789 bytes

Attaching the solution from #1 as a patch

khiminrm’s picture

StatusFileSize
new793 bytes

Made a little modification to the patch for more accurate comparison of arguments

khiminrm’s picture

Status: Active » Needs review
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

divined’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Not work with commerce fields i.e. field_product:field_price/[0 TO 10]

divined’s picture

i found problem:

Search_api_ranges.module (381)

foreach ($split_path as $key => $value) {
      if (!($key % 2) && $value == $range_field) {
        $exists = $split_path[$key + 1];
      }
    }

if we have path: site.com/filter1/value1/filter2/value2 logic !($key % 2) is fine, but if we have url like:
site.com/some_page/filter1/value1/filter2/value2 ????