steps to reproduce:

1. install fresh D7, then views UI, search_api, search_api_db, search_api_views.
2. create a search server at admin/config/search/search_api/add_server, choose database as type.
3. enable the default node index.
4. go to views settings at admin/structure/views/settings, and uncheck live preview settings, and save.
5. create a view, select 'Default node index' from the show list, give it a name, all else defaults, click 'Continue and edit'.
6. click the 'add' button for filter criteria, and select 'Search: Fulltext search', choose 'Title' under 'Searched fields', save.
7. click the 'add' button for filter criteria, and select 'Search: Fulltext search', choose 'The main body text' under 'Searched fields', save.
8. Save the view, kaboom.

Below is the exported view, should hopefully help with testing:

$view = new view;
$view->name = 'test_text_bug';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'search_api_index_default_node_index';
$view->human_name = 'test text bug';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'test text bug';
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'entity';
/* Field: Node: Node ID */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'search_api_index_default_node_index';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
/* Filter criterion: Search: Fulltext search */
$handler->display->display_options['filters']['search_api_views_fulltext']['id'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['table'] = 'search_api_index_default_node_index';
$handler->display->display_options['filters']['search_api_views_fulltext']['field'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['fields'] = array(
  'title' => 'title',
);
/* Filter criterion: Search: Fulltext search */
$handler->display->display_options['filters']['search_api_views_fulltext_1']['id'] = 'search_api_views_fulltext_1';
$handler->display->display_options['filters']['search_api_views_fulltext_1']['table'] = 'search_api_index_default_node_index';
$handler->display->display_options['filters']['search_api_views_fulltext_1']['field'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext_1']['fields'] = array(
  'body:value' => 'body:value',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test-text-bug';

the code flow goes something like this, getting stuck in a loop in SearchApiDbService::createKeysQuery():

call_user_func_array --> views_page --> view::execute_display --> views_plugin_display_page::execute --> view::render --> view::execute --> SearchApiViewsQuery::execute --> SearchApiQuery::execute --> SearchApiServer::search --> SearchApiDbService::search --> SearchApiDbService::createFilterCondition --> SearchApiDbService::createFilterCondition --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery --> SearchApiDbService::createKeysQuery

Comments

drunken monkey’s picture

Oh god, another major bug in the DB backend …
I really hope I'll be able to tackle this soon!

nick_vh’s picture

StatusFileSize
new704 bytes

Issue was caused by not checking of the filter was empty or not, should be fine now

nick_vh’s picture

StatusFileSize
new691 bytes

Updated with some cosmetics and different empty check

drunken monkey’s picture

Component: Database search » Views integration
Status: Active » Needs review

Great, thanks for finding this out! Testing this, it turns out this even failed for Solr backends, as it is really the Views handler's fault.

@ beejeebus: Is this working for you, too?

Anonymous’s picture

i'll look at this today and report back shortly.

Anonymous’s picture

+    if($this->value === "") {

can we get a space between the 'if' and the '('?

Anonymous’s picture

Status: Needs review » Needs work

also, maybe a comment for why we care about an empty string vs NULL or FALSE? something else somewhere does bad things if $this->value is an empty string, but not if $this->value == NULL or FALSE?

drunken monkey’s picture

also, maybe a comment for why we care about an empty string vs NULL or FALSE? something else somewhere does bad things if $this->value is an empty string, but not if $this->value == NULL or FALSE?

Rather, there is no way to enter a NULL or a FALSE in a text field. A user might want to search for "0", though, so this check is preferrable.
(Also, I think at least NULL might really not trigger that bug.)

I'll fix the space (thanks for spotting!) when commiting. Is the patch RTBC otherwise, in your opinion? Or should we explain the "0"/"" thing? (And if that's the case: apart from that?)

Anonymous’s picture

Status: Needs work » Reviewed & tested by the community

a comment that value is set via form field input works for me.

yes, this patch is otherwise RTBC. thanks!

drunken monkey’s picture

Title: multiple full-text fields causes fatal errors » Empty fulltext keys cause fatal error
Status: Reviewed & tested by the community » Fixed

Great, committed!
Thanks again, Nick!

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

added function trace.