With a clean install of drupal-7.15, views 7.x-3.5 (stable and -dev), the "Combine fields filter" doesn't work.
Exposed or not. With Devel installed and debugging enabled, I get :
Exception in test[test]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'CONCAT_WSnode.titlefield_data_body.body_value' in 'where clause'
This is a clean install, so no strange field type or strange data.
Here is the view :
$view = new view();
$view->name = 'test';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test';
$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';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$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'] = 'fields';
$handler->display->display_options['row_options']['inline'] = array(
'title' => 'title',
);
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: Content: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Global: Combine fields filter */
$handler->display->display_options['filters']['combine']['id'] = 'combine';
$handler->display->display_options['filters']['combine']['table'] = 'views';
$handler->display->display_options['filters']['combine']['field'] = 'combine';
$handler->display->display_options['filters']['combine']['operator'] = 'word';
$handler->display->display_options['filters']['combine']['value'] = 'aye';
$handler->display->display_options['filters']['combine']['exposed'] = TRUE;
$handler->display->display_options['filters']['combine']['expose']['operator_id'] = 'combine_op';
$handler->display->display_options['filters']['combine']['expose']['label'] = 'Combine fields filter';
$handler->display->display_options['filters']['combine']['expose']['operator'] = 'combine_op';
$handler->display->display_options['filters']['combine']['expose']['identifier'] = 'combine';
$handler->display->display_options['filters']['combine']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
);
$handler->display->display_options['filters']['combine']['fields'] = array(
'title' => 'title',
'body' => 'body',
);
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'test';
Thanks for all the hard work
Edit : it works with "Contains", but it doesn't work with "Contains any word".
Comment | File | Size | Author |
---|---|---|---|
#21 | combine_fields_filter-1782678-1.patch | 1.84 KB | mgifford |
#19 | combine_fields_filter-1782678-1.patch | 1.84 KB | jibran |
Comments
Comment #1
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commented.... The handler doesn't support "Contains word". Here is a patch.
Comment #2
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedCompletely forgot to split all the words. Inspired greatly from views_handler_filter_string.
Comment #3
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedWas matching all words instead of each word.
Comment #4
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedComment #5
jorisdejong CreditAttribution: jorisdejong commentedWas your intention to omit matches of words prefixed by a minus? As you're saving a minus in $matches when prefixed.
Comment #6
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedTo tell you the truth I just used the code from views_handler_filter_string.inc. I only changed how the where condition was called to make sure the CONCAT_WS was not stripped further down the pipe.
http://drupalcode.org/project/views.git/blob/HEAD:/handlers/views_handler_filter_string.inc
Line 260-291.
Comment #7
finneFound the same issue on my D7.15 minimal install + views 3.5. The fix in #3 worked for me.
Comment #8
jorisdejong CreditAttribution: jorisdejong commentedSame for me in 7.x-3.5 (stable) and 7.x-3.x-dev. I have tested both "Contains any word" and "Contains all words". Code-wise it's all good to go.
For the sake of commenting standards you should capitalize the first letter of the bottom comment, and change "call_user_func_array" to "call_user_func_array()".
Comment #9
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedWhile we're at it, I fixed all the other standards, except function docs and uppercase on the class name.
Comment #10
dawehnerThis looks pretty fine!
Comment #11
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedYay! My first patch got approved! :D
Comment #12
dawehnerIn general please try to avoid codestyle fixes which are unrelated with your actual patch, that's okay for this patch.
Congratulations to your first commit in views! Committed and pushed to 7.x-3.x
As for example the filename changed in d8, let's move it there.
Comment #13
srgk CreditAttribution: srgk commentedhey, thanks for the patch
What about making the search case-insensitive? now i'm getting results only for matching case
Comment #14
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedSure @srgk! Could you open another issue? This one is closed and already in -dev. I don't have time to do it this week, but I will make sure to do it at the beginning of next week.
Comment #15
srgk CreditAttribution: srgk commentedHey Pierre, thanks
if you have spare time, could you please look into the issue, i've created it here http://drupal.org/node/1805272
Comment #16
eloiguell CreditAttribution: eloiguell commentedThank Pierre! Works for me (case insensitive works too, srgk)
Comment #17
eloiguell CreditAttribution: eloiguell commentedI added the operator "Not contains any word"
I added this code in views_handler_filter_combine.inc :
And in views_handler_filter_string.inc added this:
Comment #18
xjmComment #18.0
xjmadding details about the expression
Comment #19
jibranComment #20
dawehnerGiven that db_or() and db_and() just creates objects, do you think we should just create the objects here directly?
It feels like it would be a good idea to document this regex
Comment #21
mgiffordRe-submitting the prior patch for the bots to review.
Comment #23
LendudeDuplicate of #2664530: Views Combined fields filter with "Contains any word" or "Contains all words" operator results in an incorrect SQL query and a fatal error. The patch there has tests and I think is a bit more up to date, but this is the older issue. Not sure what the right workflow is for closing.
Comment #24
dawehnerLet's go with the other issue
Comment #25
mgiffordOk, so it's a duplicate then.
Comment #26
epersonae2 CreditAttribution: epersonae2 commentedIs there going to be a fix for this problem for Views 7.3.x?