Hi!
I try the last version of this module and if I try to create a view, when I view the page I obtain a blank page, my apache log says:

[Wed Oct 31 17:37:35 2012] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function datasource() on a non-object in /mysite/sites/all/modules/contrib/search_api_multi/views/query.inc on line 100

Comments

eme’s picture

Priority: Normal » Major

Same here using Apache SOLR, last version of Views and last version of search api and current + dev version of this module and search API.

arrubiu’s picture

I've tried the dev version, also this doesn't work.
My drupal logs say:

Notice: Trying to get property of non-object in SearchApiMultiViewsQuery->get_result_wrappers() (linea 99 di /home/sdurzu/mysite/sites/all/modules/contrib/search_api_multi/views/query.inc).

And apache logs say:

[Tue Nov 13 09:14:20 2012] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function datasource() on a non-object in /home/sdurzu/mysite/sites/all/modules/contrib/search_api_multi/views/query.inc on line 100

minoroffense’s picture

When use var_dump the following (from search_api_multi/views/query.inc:100)

public function get_result_wrappers($results, $relationship = NULL, $field = NULL) {
    $wrappers = array();
    $load_items = array();
    $entity_types = entity_get_info();

    // Entity property info for the results.
    $info = array();
    var_dump($this->indexes);
    foreach ($this->indexes as $index_id => $index) {
      $info['property info'][$index_id] = array(
       	'label' => t('@index results', array('@index' => $index->name)),
       	'type' => $index->item_type,
       	'description' => t('Results from the @index index.', array('@index' => $index->name)),
      );
      if (empty($entity_types[$index->item_type])) {
        $info['property info'][$index_id] += $index->datasource()->getMetadataWrapper()->info();
      }
    }

I get

array
  'solr_on_nimbus_index' => boolean false

The solr search has two indexes: the defautl node one and one I added for the user entities. I create a single page view using the "Solr" base table.

Using the dev version of search api, search api solr and search api multi index. Every other module is using the latest stable.

minoroffense’s picture

The results I get back from Solr are for an index that don't exist on this Drupal site. It is an old dev index. If we look at the results array from solr (in my case) I get:

array
  0 => 
    array
      'id' => string '19' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  1 => 
    array
      'id' => string '20' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  2 => 
    array
      'id' => string '21' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  3 => 
    array
      'id' => string '22' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  4 => 
    array
      'id' => string '23' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  5 => 
    array
      'id' => string '24' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  6 => 
    array
      'id' => string '25' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  7 => 
    array
      'id' => string '26' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  8 => 
    array
      'id' => string '27' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1
  9 => 
    array
      'id' => string '28' (length=2)
      'index_id' => string 'solr_on_nimbus_index' (length=20)
      'score' => float 1

from search_api_multi/views/query.inc:49

  protected function addResults(array $results, $view) {
    $rows = array();
var_dump($results);  
  foreach ($results as $id => $result) {
      $row = array();

I wonder if the Solr configuration needs updating to limit the index results to only those for the given Drupal site. Or the case may be for multi index searches, the Solr server needs to exist for this site alone. Are the solr instances you're using shared as well or are they dedicated to only the Drupal site in question. I'm not an expert in deploying Solr so I can't answer that question.

minoroffense’s picture

StatusFileSize
new71.14 KB

If in your Filter criteria in Views, you add an entry for "Search: Index" and limit to your own search indexes. the search results start working again. See the screenshot below.

eme’s picture

Good catch : same here. It misses some sort of "all server" parameter. If you expose the filter criteria, it does not work again (by default it is "all"), il works again if you require it..

minoroffense’s picture

Alright, in the end I got things working. There are definitely some sanity check bugs in the code which need to be added but for the most part it's an issue of documentation.

To get this to work, ensure you're:

  1. Using the lastest dev release for search_api_solr
  2. Using the latest configuration files provided from search_api_solr
  3. Do NOT use the default node index which comes with search_api (it wasn't returning results in a multi-index environment)
  4. Use the views filters for search index (otherwise the view will break if your Solr server has other indexes from other sites on it)

I'll post some issues from my "adventure" with the module to help make it easier to use.

Thanks.

drunken monkey’s picture

Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new666 bytes
new3.47 KB

Well, normally you of course shouldn't leave stale data on your Solr server, and using the same server for several sites also isn't supported as such.
However, since several of you seem to have problems, please try the attached patches for this module and the Solr module.
Either of those should fix the issue, so it would be great if you could first test one, then revert again and test the other one.
If both work, I'll commit both, of course.

drunken monkey’s picture

No-one here to test these? I'd like to fix this issue before I create a stable release, but would like to do that soon.

minoroffense’s picture

I'll be doing more work on the search portion of a client project next week. I can test the patches then. Hopefully that works well for your schedule.

drunken monkey’s picture

Will you test/review soon or should I just commit this and hope for the best?

minoroffense’s picture

Working on it now. Just getting Solr back up and running.

minoroffense’s picture

Patches seem to work. Not getting errors anymore.

drunken monkey’s picture

Status: Needs review » Fixed

OK, thanks for testing.
Committed!

Status: Fixed » Closed (fixed)

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