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
Comment | File | Size | Author |
---|---|---|---|
#3 | viewsemptyfield-1251674-3.patch | 691 bytes | Nick_vh |
#2 | viewsemptyfield-1251674-2.patch | 704 bytes | Nick_vh |
Comments
Comment #1
drunken monkeyOh god, another major bug in the DB backend …
I really hope I'll be able to tackle this soon!
Comment #2
Nick_vhIssue was caused by not checking of the filter was empty or not, should be fine now
Comment #3
Nick_vhUpdated with some cosmetics and different empty check
Comment #4
drunken monkeyGreat, 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?
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedi'll look at this today and report back shortly.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedcan we get a space between the 'if' and the '('?
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedalso, 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?
Comment #8
drunken monkeyRather, there is no way to enter a
NULL
or aFALSE
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?)
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commenteda comment that value is set via form field input works for me.
yes, this patch is otherwise RTBC. thanks!
Comment #10
drunken monkeyGreat, committed!
Thanks again, Nick!
Comment #11.0
(not verified) CreditAttribution: commentedadded function trace.