With a "Multi-index search" view when clicking "Query settings: Settings" it gives the following error:
Error: Call to a member function getEntityType() on null in SearchApiViewsQuery->options_form() (line 216 of search_api/contrib/search_api_views/includes/query.inc).
Can be worked-around by doing:
search_api/contrib/search_api_views/includes/query.inc
public function options_form(&$form, &$form_state) {
...
- if ($this->index->getEntityType()) {
+ if ($this->index && $this->index->getEntityType()) {
$form['entity_access'] = array(
'#type' => 'checkbox',
'#title' => t('Additional access checks on result entities'),
'#description' => t("Execute an access check for all <snip>"),
'#default_value' => $this->options['entity_access'],
);
}
...
}
Comments
Comment #2
mustanggb commentedTruncated #description for readability.
Comment #3
drunken monkeyWith "Multi-index search" you mean a search powered by the "Search API multi-index searches" module?
Then why not report it in that module? Seems like it should be fixed there.
Comment #4
mustanggb commented@drunken monkey:
Yes, that's exactly what I meant. If it's a requirement of search_api that "index" is specified then I agree it should be fixed in search_api_multi. As for why I reported it here, well only because this is my first time using this family of modules so I'm not particularly au fait with their inner working, "Multi-index search" is the only view I've created so far, so I wasn't aware that this wasn't an issue for the other index types, and as I mentioned originally my findings were only a worked-around rather than an explicit fix. I was envisaging that which module should contain the fix would be at your prerogative.
Comment #5
drunken monkeyThanks for the information!
After taking a closer look at the multi-index Views query plugin, it seems it's not really possible to fix the problem just there after all (unless with a pretty large, hack-ish workaround). So, I guess adding that small additional check to the Search API Views query plugin is the simpler and better option. Doesn't really hurt in any case, after all.
Sorry for the confusion!
Comment #6
highermath commentedThe patch effectively fixes this specific issue and does not break anything else in testing. I believe that even if it is not perfect, it is good, and it should be committed.
Comment #7
drunken monkeyGood to hear, thanks for the feedback!
Committed.