Problem/Motivation

When using this module with a Solr 3.x or 4.x backend, the "Refresh metadata now" button never works.
You can also never get the facet counts because getting the hases is also broken.

How to reproduce :

  • Install Solr 3.x or 4.x
  • Install the latest module and the latest Apache Solr Integration.
  • Go to the Multisite tab and hit "Refresh", nothing appears.
  • Check the Drupal reports, you should see a new line.

The problem is due to how queries to get both the metadata and hashes are performed:

 // Get the $solr object
    $solr = apachesolr_get_solr();
    $params['qt'] = 'standard';
    $params['fl'] = '*';
    $params['facet'] = 'true';
    $params['facet.field'][] = 'hash';
    $params['facet.mincount'] = 1;
    $params['facet.limit'] = '1000';
    $response = $solr->search('*:*', $params);
    $results = (array)$response->facet_counts->facet_fields->hash;
    return $results;

The line $params['qt'] = 'standard'; is not valid for Solr 3.x and 4.x and breaks the query.

Proposed resolution

Use a simple "version check" to know if we should add the qt parameter or not:

// Get the $solr object
    $solr = apachesolr_get_solr();
    //This is only needed for Solr 1. Solr 3 and 4 queries are broken by this param
    if($solr->getSolrVersion() == '1'){
      $params['qt'] = 'standard';
    }
    $params['fl'] = '*';
    $params['facet'] = 'true';
    $params['facet.field'][] = 'hash';
    $params['facet.mincount'] = 1;
    $params['facet.limit'] = '1000';
    $response = $solr->search('*:*', $params);
    $results = (array)$response->facet_counts->facet_fields->hash;
    return $results;

This also has to be done line 69.

Remaining tasks

This needs to be reviewed and re-tested against Solr 1, 3 and 4 in case my implementation was the real problem.

User interface changes

None.

API changes

None.

None.

I'll attach the patch in the next message to get the issue number.

CommentFileSizeAuthor
#1 2017689-1.patch889 bytespwolanin

Comments

pwolanin’s picture

StatusFileSize
new889 bytes

The 'standard' qt was added back to the common config.

However, this is a better patch that should work across all versions.

Growiel’s picture

This is still not fixed in the latest dev.

Please merge pwolanin's patch, modifying it by hand each time I update the module is really not optimal.

pwolanin’s picture

Issue summary: View changes
Status: Needs review » Fixed

committed for 7.x-1.x and 6.x-3.x

Status: Fixed » Closed (fixed)

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