We saw some serious performance issues with a customer using the 6.x branch - possibly the same bug is present in 7.x.

see: http://www.derivante.com/2009/04/27/100x-increase-in-solr-performance-an...

In apachesolr.module in 7.x we handle this problem with the following code:

  if (strlen($keys) == 0 && ($filters = $query->getFilters())) {
    // Move the fq params to q.alt for better performance. Only suitable
    // when using dismax or edismax, so we keep this out of the query class itself
    // for now.
    $qalt = array();
    foreach ($filters as $delta => $filter) {
      // Move the fq param if it has no local params and is not negative.
      if (!$filter['#exclude'] && !$filter['#local']) {
        $qalt[] = '(' . $query->makeFilterQuery($filter) . ')';
        $query->removeFilter($filter['#name'], $filter['#value'], $filter['#exclude']);
      }
    }
    if ($qalt) {
      $query->addParam('q.alt', implode(' ', $qalt));
    }
  }

There is similar code in 6.x-1.x

Comments

pwolanin’s picture

Title: 100x performance hit due to not rewritign fq to q.alt » 100x performance hit due to not rewriting fq to q.alt
pwolanin’s picture

Obviously if you are using the standard query parser you can do the same thing by setting the q param, as described in the blog post above.

rjbrown99’s picture

pwolanin - Can you clarify where you are applying this logic in the module? IE - what function in apachesolr.module? apachesolr_views_views_post_execute() perhaps?

pwolanin’s picture

The code I posted above is in apachesolr.module in function apachesolr_do_query()

rjbrown99’s picture

Aaah thank you - this issue is in the apachesolr_views issue queue which is where my confusion came from.

ygerasimov’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev

7.x branch does use apachesolr_do_query() to perform the query. Moving this issue to 6.x branch.

ygerasimov’s picture

Issue summary: View changes

note 6.x

kenorb’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Fixed

Version 6.x is no longer supported due to Drupal 6 End of Life. This issue is fixed for 7.x as per #6

Status: Fixed » Closed (fixed)

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