All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Does not contain in field search

Ben Fjare 26 Apr 2019 15:11 question, pending

Is it possible to do a does not contain in a grid field search? something like...

search:field:column="-value\W"

or

search:field:column="not value\W"

Replies

  1. Low 27 Apr 2019 13:26

    That last example should work. If it's not, enable template debugging and copy/paste all lines that mention Low Search here, as well as all SQL queries generated by LS.

  2. Ben Fjare 29 Apr 2019 16:40

    Yea I am afraid it loads everything. Here are the results.

    Calling Tag: {exp:low_search:results search:attraction_info:info="not Bozeman\W" channel="attractions" category="73" dynamic="no" orderby="title" sort="asc"}
    0.526718 / 12.1MB Low Search: Applying Low_search_filter_field_search
    0.526758 / 12.1MB Low Search: Getting channel field info from API
    0.530572 / 12.2MB Low Search: Done getting channel field info from API
    0.537539 / 12.3MB Low Search: Applying Low_search_filter_categories
    0.539471 / 12.2MB Low Search: Applying Low_search_filter_keywords
    0.539496 / 12.2MB Low Search: No keyword search
    0.539991 / 12.2MB Low Search: Setting entry_id param
    0.540027 / 12.2MB Low Search: Parameters set: search:attraction_info:info="not Bozeman\W" channel="attractions" dynamic="no" orderby="title" sort="asc" entry_id="358|367|371|376|381|393|404|750|940|986|989|1036|1134"
    0.540029 / 12.2MB Low Search: Pre-applying search vars to tagdata
    0.540404 / 12.2MB Low Search: Calling the channel module
    0.580252 / 13.1MB Calling Extension Class/Method: Assets_ext/channel_entries_query_result
    0.591432 / 13.2MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result
    0.943997 / 14.4MB -> Data Returned

    SELECT 'settings'
    FROM ('exp_extensions')
    WHERE 'class' = 'Low_search_ext'
    LIMIT 1
    #system/user/addons/low_search/libraries/Low_search_params.php L:148 Low_search_settings::get()

    SELECT 'field_id', 'field_type', 'field_fmt', 'field_name', 'site_id', 'field_settings'
    FROM ('exp_channel_fields')
    #system/user/addons/low_search/libraries/Low_search_fields.php L:75 Api_channel_fields::fetch_custom_channel_fields()

    SELECT 'col_id', 'col_name', 'col_type'
    FROM ('exp_grid_columns')
    WHERE 'field_id' = 117
    #system/user/addons/low_search/libraries/Low_search_fields.php L:299 Low_search_fields::_col()

    SELECT DISTINCT 'entry_id'
    FROM ('exp_channel_grid_field_117')
    WHERE (col_id_4 NOT REGEXP '[[::]]')
    #system/user/addons/low_search/libraries/Low_search_filters.php L:153 Low_search_filter_field_search::filter()

    SELECT DISTINCT 'entry_id'
    FROM ('exp_category_posts')
    WHERE 'cat_id' IN ('73')
    AND 'entry_id' IN (327, 332, 346, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 383, 384, 385, 386, 388, 389, 391, 392, 393, 394, 396, 397, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 430, 431, 432, 433, 434, 437, 438, 439, 440, 441, 443, 444, 445, 447, 448, 449, 450, 451, 452, 453, 454, 456, 457, 459, 460, 461, 462, 463, 464, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 478, 479, 480, 482, 483, 484, 485, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 500, 501, 502, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 537, 538, 539, 541, 542, 543, 544, 547, 548, 551, 552, 553, 555, 556, 557, 560, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 576, 577, 578, 579, 582, 584, 585, 588, 591, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 612, 613, 614, 615, 619, 621, 622, 623, 625, 627, 628, 629, 630, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 643, 718, 734, 750, 751, 752, 753, 759, 800, 801, 803, 804, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 819, 820, 821, 822, 823, 824, 825, 826, 827, 829, 830, 831, 832, 833, 834, 836, 837, 841, 842, 843, 844, 845, 867, 896, 897, 901, 910, 912, 927, 928, 932, 933, 934, 937, 939, 940, 959, 960, 961, 986, 989, 991, 995, 997, 998, 999, 1006, 1014, 1015, 1019, 1023, 1026, 1028, 1029, 1030, 1031, 1032, 1033, 1036, 1040, 1070, 1071, 1080, 1084, 1086, 1088, 1093, 1112, 1113, 1117, 1118, 1119, 1122, 1123, 1124, 1126, 1131, 1132, 1134, 1141, 1153)
    #system/user/addons/low_search/libraries/Low_search_filters.php L:153 Low_search_filter_categories::filter()
    0.0004s
    43KB

    SELECT 'channel_id', 'channel_name', 'search_excerpt', IF(search_results_url='', channel_url, search_results_url) AS url
    FROM ('exp_channels')
    WHERE 'site_id' IN (1)
    AND 'channel_name' IN ('attractions')
    #system/user/addons/low_search/filters/keywords/lsf.keywords.php L:127 Low_search_filter_keywords::_no_keywords()
    0.0004s
    42KB

    SELECT t.entry_id, t.channel_id, t.forum_topic_id, t.author_id, t.ip_address, t.title, t.url_title, t.status, t.view_count_one, t.view_count_two, t.view_count_three, t.view_count_four, t.allow_comments, t.comment_expiration_date, t.sticky, t.entry_date, t.year, t.month, t.day, t.edit_date, t.expiration_date, t.recent_comment_date, t.comment_total, t.site_id as entry_site_id,
    w.channel_title, w.channel_name, w.channel_url, w.comment_url, w.comment_moderate, w.channel_html_formatting, w.channel_allow_img_urls, w.channel_auto_link_urls, w.comment_system_enabled,
    m.username, m.email, m.url, m.screen_name, m.location, m.occupation, m.interests, m.aol_im, m.yahoo_im, m.msn_im, m.icq, m.signature, m.sig_img_filename, m.sig_img_width, m.sig_img_height, m.avatar_filename, m.avatar_width, m.avatar_height, m.photo_filename, m.photo_width, m.photo_height, m.group_id, m.member_id, m.bday_d, m.bday_m, m.bday_y, m.bio,
    md.*,
    wd.*
    FROM exp_channel_titles AS t
    LEFT JOIN exp_channels AS w ON t.channel_id = w.channel_id
    LEFT JOIN exp_channel_data AS wd ON t.entry_id = wd.entry_id
    LEFT JOIN exp_members AS m ON m.member_id = t.author_id
    LEFT JOIN exp_member_data AS md ON md.member_id = m.member_id WHERE t.entry_id IN (940,358,371,376,989,381,1036,1134,404,393,986) ORDER BY t.sticky desc, t.title asc, t.entry_id asc
    #system/user/addons/low_search/mod.low_search.php L:2038 Channel::entries()

  3. Low 30 Apr 2019 06:30

    What are your EE and LS versions?

  4. Ben Fjare 1 May 2019 19:47

    ee 3.5.10
    low search 5.2.0

  5. Low 2 May 2019 07:05

    I'm seeing this in your log:

     SELECT DISTINCT 'entry_id'  
    FROM ('exp_channel_grid_field_117')
    WHERE (col_id_4 NOT REGEXP '[[::]]')


    ...which should contain the search term in there, but doesn't. Can't replicate that behaviour locally, so I'll need to take a look myself. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.

  6. Low 1 Jul 2019 07:01

    Okay, I see what's going on.

    First of all, GetSat stripped out a part of the query above ('cause it looked like an html tag), so it looked weird, but in fact it was correct:

    SELECT DISTINCT 'entry_id' 
    FROM ('exp_channel_grid_field_117')
    WHERE (col_id_4 NOT REGEXP '[[:<:]]bozeman[[:>:]]')


    This is the correct statement. However, this will only wield the expected results if all of the Grid rows contain 'bozeman', rather than any.

    I can see how this can be confusing and will look into changing this behaviour, so it behaves like the opposite of search:grid:column="bozeman"

  7. Ben Fjare 10 Jul 2019 19:12

    Thanks, Low. Would be happy to pay for this functionality to be expedited.

  8. Low 11 Jul 2019 09:16

    For now, you can try the following workaround: make sure the Grid column in question is searchable (which would put all of the searchable content in the channel_data field) and then use search:grid_field="not bozeman\W" (so not targeting the column, but the entire field itself).

    You might need to re-save the entries if the column (and field itself) weren't searchable before, to populate the searchable field itself.