Hi,

When working with facets the view path for facet filtering link is not being set in the Sorl Base Query. The this happens in the line 93 of the apachesolr_views_query.inc

$query = new SolrBaseQuery('apachesolr', $solr, $params, $solrsort, '');

It should be fixed as follows:

$query = new SolrBaseQuery('apachesolr', $solr, $params, $solrsort, 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);

Comments

julianmancera’s picture

Bumping this issue.

Is any of the maintainers giving support?

Julian Mancera

julianmancera’s picture

Hi all,

I found an issue on my change above here is the final one

$request = explode("?", $_SERVER['REQUEST_URI']);
$query = new SolrBaseQuery('apachesolr', $solr, $params, $solrsort, 'http://' . $_SERVER['SERVER_NAME'] . $request[0]);

Julian Mancera

N20’s picture

thanks for the quick fix... i had exactly the same problem.

janakiram’s picture

i have done the changes but now i am ending up with slashes //, every time u narrow down the filters u add up with a /..

http://localhost/books///?f[0]=im_field_cushop%3A12

http://localhost/books/////

julianmancera’s picture

Hi janakiram,

Currently I don´t have a clean fix for this issue, we will need to submit a ticket on the apachesolr module for a quick fix

You should change the function getPath in the Solr_Base_Query.php file to add a conditional so we supress the extra slashes

public function getPath($new_keywords = NULL) {
    if (isset($new_keywords)) {
      return $this->base_path . '/' . $new_keywords;
    }
    if($this->getParam('q')) {
      return $this->base_path . '/' . $this->getParam('q');
    }else {
      return $this->base_path;
    }
  }

Regards,

Julian Mancera

julianmancera’s picture

Here is the ticket so you can follow

http://drupal.org/node/1538244

Regards,

Julian Mancera

Nick_vh’s picture

I was hoping to see a use case on how to replicate a problem that would be fixed by this patch. Is there anything like that? or could you write up a small guide that helps us understand why this is needed?

julianmancera’s picture

Hi Nick,

Here is how to reproduce it

  1. Set up solr on a test site
  2. Create a cck with some indexable attributes like text lines
  3. Download and install apache solr views
  4. Create an apachesolr view just to show some indexed elements
  5. Donwload and install facets module http://drupal.org/project/facetapi
  6. Enable your attributes facet in your site's solr environment admin/config/search/apachesolr/settings Facets link
  7. Click on Configure display for each enabled facet so you can select both links or checkboxes
  8. Go to blocks admin page and assing each facet a region, usually the first sidebar, don't configure visibility settings it won't work
  9. Apply the patches listed in this post http://drupal.org/node/1402868#comment-5575974
  10. If you start to do some faceted filtering you will see that the filter url add extra slashes to the filter link after the query string like http://localhost/books///?f[0]=im_field_cushop%3A12

Regards,

Julian Mancera

topham’s picture

I modified comment #2 (http://drupal.org/node/1428630#comment-5677664) to rtrim($request[0],'/') with success. This eliminates the need to modify solr_base_query.php.
(solr_base_query can append all the slashes it wants, as long was we remove trailing slashes from $request[0] first we are golden).

ygerasimov’s picture

Status: Active » Fixed

Thanks for pointing out the problem in construction of SolrBaseQuery. I think we should simply pass current_path() value there.

There was another problem when fulltext search used facets get link with keyword added in the end.

I have committed custom ApachesolrViewsSolrBaseQuery that removes this problem. Welcome to test.

Please reopen this issue if still have any problems.

Commit f837a6c

Status: Fixed » Closed (fixed)

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