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

Support archive

Low Search omitting certain entries when using search:field_name

James Catt 8 Feb 2017 17:42 problem, complete

EE 3.5.1, Low Search 5.0.5

I have certain entries that I don't want to show up in search results, so I have a checkbox field called hide_from_search that's checked for those entries. Here's a simplified test case for my Low Search call:


{exp:low_search:results query="{segment_3}" collection="pages|blog|calendar_events" status="open" search:hide_from_search="not yes"}


Most of the time this works as expected, but I've discovered that certain entries are being excluded incorrectly.

For example, I have an entry in the 'pages' channel called 'Tenant Directory'. The hide_from_search field is not checked for this entry--but when I search for "tenant" it doesn't show up in the results unless I remove the search parameter. I've tried other entries with multiple search terms that should return the entry, but it won't show up under any of them—so I think it's something about the entry rather than the search terms.

I've tried changing all the other parameters with no effect, as well as adding smart_field_search="yes", modifying the collection settings and rebuilding the collection, all with no luck. The only way to get the affected entries to show up is to remove the search parameter.

Note: This problem doesn't occur under EE 2.11.3 / Low Search 4.4.3 (we recently upgraded)

Replies

  1. Low 8 Feb 2017 17:57

    Can you enable the debugger and share the template debugging data as well as any queries generated by LS?

  2. James Catt 8 Feb 2017 18:26

    Sure thing. Here's the template debugging output:

    Templates

    0.000019 / 10.3MB - Begin Template Processing -
    0.000051 / 10.3MB URI: custom/test/eyJyZXN1bHRfcGFnZSI6Ilwvc2VhcmNoXC9yZXN1bHRzIiwia2V5d29yZHMiOiJ0ZW5hbnQifQ
    0.000063 / 10.3MB Template: /
    0.005102 / 10.4MB Template Group Found: custom
    0.005991 / 10.4MB Retrieving Template from Database: custom/test
    0.007378 / 10.5MB Retrieving Template from File
    0.010841 / 10.7MB Template Type: webpage
    0.010871 / 10.7MB Parsing Site Variables
    0.011508 / 10.7MB Config Assignments & Template Partials
    0.011881 / 10.7MB Parse Current Time Variables
    0.011987 / 10.7MB Parsing Segment, Embed, Layout, logged_in_*, and Global Vars Conditionals
    0.019484 / 10.8MB - Beginning Tag Processing -
    0.019513 / 10.8MB Detecting Tags in Template
    0.019774 / 10.8MB Running Tags
    0.021035 / 10.8MB Calling Tag: {exp:channel:entries channel="pages" search:hide_from_search="not yes"}
    0.154596 / 20.3MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result
    0.438055 / 24.6MB -> Data Returned
    0.440940 / 24.8MB Calling Tag: {exp:low_search:results query="eyJyZXN1bHRfcGFnZSI6Ilwvc2VhcmNoXC9yZXN1bHRzIiwia2V5d29yZHMiOiJ0ZW5hbnQifQ" collection="blog|calendar_events|pages" search:hide_from_search="not yes"}
    0.447571 / 25.4MB Low Search: Applying Low_search_filter_field_search
    0.522710 / 26.1MB Low Search: Applying Low_search_filter_keywords
    0.524168 / 26.1MB Low Search: Keywords: tenant
    0.526503 / 26.2MB Low Search: Starting search (fulltext)
    0.530955 / 26.2MB Low Search: Applying collection modifier to search results
    0.530995 / 26.3MB Low Search: Ordering results by score
    0.531012 / 26.3MB Low Search: Returning entry IDs
    0.531489 / 25.6MB Low Search: Setting fixed_order param
    0.531642 / 25.6MB Low Search: Parameters set: query="eyJyZXN1bHRfcGFnZSI6Ilwvc2VhcmNoXC9yZXN1bHRzIiwia2V5d29yZHMiOiJ0ZW5hbnQifQ" collection="blog|calendar_events|pages" search:hide_from_search="not yes" result_page="/search/results" keywords="tenant" fixed_order="9788"
    0.531655 / 25.6MB Low Search: Pre-applying search vars to tagdata
    0.531835 / 25.6MB Low Search: Calling the channel module
    0.541812 / 19.2MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result
    0.560896 / 19.2MB -> Data Returned
    0.561002 / 19.2MB - End Tag Processing -
    0.563962 / 19.2MB Calling Extension Class/Method: Structure_ext/template_post_parse
    0.564100 / 19.1MB - End Template Processing -
    0.564111 / 19.1MB Parse Global Variables
    0.566452 / 19.1MB Template Parsing Finished

    ...and the queries from LS:

    0.0004s
    15KB
    SELECT *
    FROM ('exp_low_search_collections')
    ORDER BY 'collection_label' asc
    #system/user/addons/low_search/models/low_search_collection_model.php L:87 Low_search_model::get_all()

    0.0313s
    37KB
    SELECT DISTINCT 'entry_id'
    FROM ('exp_channel_data')
    WHERE (field_id_334 NOT LIKE '%yes%')
    AND 'channel_id' IN (5, 7, 3)
    AND 'site_id' IN (1)
    #system/user/addons/low_search/libraries/Low_search_filters.php L:145 Low_search_filter_field_search::filter()

    0.0036s
    45KB
    SELECT exp_low_search_indexes.entry_id, exp_low_search_indexes.collection_id, MATCH(exp_low_search_indexes.index_text) AGAINST('tenant') AS 'score'
    FROM ('exp_low_search_indexes')
    WHERE 'collection_id' IN (1, 2, 3)
    AND 'exp_low_search_indexes'.'site_id' IN (1)
    AND 'exp_low_search_indexes'.'entry_id' IN (3, 9, 10, 11, 14, 20, 21, 23, 24, 25, 28, 29, 30, 32, 33, 34, 12147, 35, 12504, 12385, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 11477, 60, 61, 62, 63, 64, 66, 69, 70, 72, 73, 11767, 75, 76, 77, 79, 80, 81, 82, 84, 85, 86, 87, 89, 91, 92, 93, 94, 95, 97, 98, 99, 100, 101, 10953, 102, 103, 104, 106, 108, 109, 110, 111, 113, 114, 115, 116, 117, 11388, 120, 121, 122, 123, 124, 125, 127, 6233, 6234, 6232, 6231, 6226, 6227, 6228, 6229, 6230, 6073, 6074, 6075, 6049, 6050, 6051, 6052, 6053, 6054, 6069, 6070, 6071, 6072, 6082, 6083, 6084, 6085, 6086, 6087, 6114, 6115, 6113, 6116, 6117, 6118, 6119, 6120, 6163, 6162, 6149, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6147, 6146, 6145, 6144, 6142, 6143, 6140, 6141, 6139, 6136, 6137, 6138, 6394, 6395, 6396, 6393, 6390, 6391, 6392, 6279, 6204, 6205, 6206, 6207, 6208, 6192, 6165, 6164, 6148, 6225, 6224, 6222, 6223, 6220, 6221, 6015, 6016, 6018, 6017, 6019, 6020, 6021, 6022, 6026, 6024, 6023, 6025, 6027, 6028, 6029, 6030, 6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6041, 6042, 6040, 6043, 6044, 6045, 6046, 6047, 6048, 6055, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6088, 6076, 6077, 6078, 6079, 6080, 6081, 6089, 6090, 6091, 6092, 6093, 6094, 6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6124, 6121, 6122, 6123, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6176, 6166, 6167, 6168, 6169, 6170, 6171, 6172, 6173, 6183, 6184, 6185, 6174, 6175, 6177, 6178, 6179, 6180, 6181, 6182, 6186, 6187, 6188, 6189, 6190, 6191, 6193, 6194, 6195, 6196, 6197, 6198, 6199, 6200, 6201, 6202, 6209, 6203, 6210, 6211, 6212, 6213, 6214, 6215, 6216, 6217, 6218, 6219, 6244, 6245, 6246, 6247, 6248, 6249, 6250, 6251, 6252, 6253, 6254, 6255, 6256, 6257, 6258, 6259, 6260, 6261, 6262, 6263, 6264, 6265, 6266, 6267, 6268, 6269, 6270, 6271, 6272, 6273, 6274, 6275, 6276, 6277, 6278, 6280, 6281, 6282, 6283, 6284, 6285, 6286, 6287, 6288, 6289, 6290, 6291, 6292, 6293, 6294, 6295, 6296, 6297, 6298, 6299, 6300, 6301, 6302, 6303, 6304, 6305, 6306, 6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6242, 6240, 6239, 6238, 6235, 6236, 6237, 6241, 6243, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6491, 6498, 6499, 6500, 6501, 6490, 6502, 6492, 6493, 6494, 6495, 6496, 6497, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 8010, 8952, 8953, 8955, 8956, 11228, 8960, 8961, 11227, 11223, 10159, 10157, 9001, 9011, 9035, 9041, 11765, 12560, 9418, 9420, 9421, 9422, 9423, 9425, 9447, 9452, 9453, 9454, 11343, 10709, 9484, 9486, 10743, 9489, 11639, 9490, 9516, 9491, 11856, 11493, 9492, 10095, 9503, 9504, 9506, 9507, 9508, 9509, 10616, 9523, 9518, 9519, 9520, 9521, 9522, 9525, 9526, 11922, 11652, 9531, 11872, 11509, 11510, 11511, 9536, 11092, 11093, 11094, 10102, 9538, 9539, 9543, 9734, 11342, 9563, 9545, 9546, 9547, 9548, 9549, 11572, 9587, 9588, 9924, 9593, 9552, 9590, 9591, 9553, 9554, 9761, 9555, 12559, 9561, 9562, 9595, 9596, 11066, 9598, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9580, 11571, 9586, 9589, 9601, 9602, 9606, 9607, 9608, 9948, 9610, 10081, 9614, 9615, 9687, 9618, 9616, 9619, 9631, 9632, 9634, 11512, 12398, 9640, 9643, 10789, 9665, 9684, 9686, 9693, 9695, 9721, 9697, 9720, 9696, 9698, 9699, 9719, 9701, 9709, 9735, 9740, 9717, 9718, 9722, 9723, 9724, 9725, 9791, 9737, 9742, 9743, 9744, 9745, 9747, 9748, 9749, 9757, 9758, 9765, 9760, 9762, 9763, 9766, 9790, 9789, 9788, 9787, 9786, 9785, 9784, 9782, 9783, 9780, 9781, 9779, 9792, 9793, 9798, 9799, 9800, 9802, 9803, 9804, 9805, 9806, 9908, 9909, 11582, 11548, 9910, 10004, 9911, 9921, 9922, 9923, 9930, 12582, 12581, 9946, 9949, 9954, 9956, 9958, 9961, 11406, 9969, 9966, 10072, 9999, 10001, 10002, 10007, 10064, 10066, 10068, 10060, 10071, 10067, 10073, 10075, 10079, 10080, 10084, 10083, 10086, 10088, 10091, 10090, 10609, 10092, 10093, 10094, 10098, 10099, 10100, 10106, 10213, 10134, 10110, 10112, 10113, 10114, 10115, 10116, 10117, 10118, 10119, 10121, 10122, 10126, 10127, 10129, 10130, 10131, 10137, 10132, 10133, 10135, 10136, 10145, 10143, 10146, 11134, 10147, 10150, 10149, 10151, 10152, 10153, 10158, 10170, 10160, 10161, 10162, 10163, 10164, 10171, 10167, 10173, 10175, 10186, 10188, 10189, 10191, 10192, 10194, 10196, 10200, 10201, 10202, 11852, 11817, 10217, 12076, 10227, 10212, 10250, 11626, 10251, 10252, 10235, 10214, 10215, 10216, 10256, 10218, 11501, 10222, 10225, 10232, 10233, 10234, 10236, 10240, 10241, 10242, 10259, 10461, 10463, 10464, 10466, 10467, 10471, 10468, 10492, 10600, 10597, 10598, 10601, 10603, 10607, 10608, 10610, 10651, 10611, 10613, 10619, 10620, 10624, 10626, 10629, 10640, 10647, 10649, 11347, 10650, 10634, 10637, 10641, 10644, 10645, 10646, 10653, 10655, 10657, 10707, 10708, 10716, 10714, 10718, 10722, 10723, 10721, 10726, 10728, 10725, 10731, 10730, 10734, 10736, 10737, 10739, 10777, 11838, 10781, 11855, 10782, 10741, 10750, 10751, 10753, 10755, 10756, 10757, 10758, 10759, 10760, 10762, 10764, 10768, 10769, 10778, 10783, 10797, 12605, 12606, 10787, 10790, 10791, 10792, 10798, 10800, 10801, 11917, 11916, 11503, 10802, 10805, 10804, 10820, 11773, 10949, 10951, 10952, 10955, 10956, 10957, 12110, 10960, 10961, 10962, 12549, 10982, 10967, 10971, 10973, 10983, 10975, 10976, 10977, 10978, 10979, 10980, 10984, 10986, 10987, 10988, 10989, 11923, 10991, 10992, 10997, 10998, 10999, 11000, 11001, 11002, 11016, 11025, 12627, 11017, 11018, 11020, 11028, 11029, 11030, 11034, 11067, 11055, 11812, 11039, 11044, 11045, 11051, 11056, 11058, 12413, 11059, 12596, 11061, 12360, 11062, 11063, 11077, 11103, 11084, 11085, 11213, 11087, 11088, 11089, 11091, 11813, 11815, 11641, 11452, 11456, 11457, 11458, 11097, 11100, 11110, 11112, 11115, 11116, 11118, 11119, 11121, 11124, 11135, 11962, 11136, 11137, 11138, 11139, 11140, 11141, 11142, 11144, 11145, 11146, 11147, 11148, 11149, 11150, 11153, 11154, 11155, 11156, 11157, 11159, 11160, 11161, 11214, 11163, 11211, 11216, 11229, 11230, 11289, 11274, 11242, 11246, 11247, 11249, 11252, 11253, 11255, 11256, 11257, 11258, 11259, 11260, 11261, 11262, 11263, 11264, 11810, 11266, 11267, 11268, 11275, 11328, 11276, 11288, 11302, 11303, 11304, 11305, 12474, 12471, 12472, 11312, 11313, 11314, 11315, 11317, 11325, 11329, 11330, 11331, 11332, 11356, 12446, 11362, 11363, 11381, 11407, 11387, 11394, 11392, 11393, 11395, 11396, 11397, 11399, 11402, 11403, 11408, 11409, 11416, 11417, 11421, 11422, 11498, 11449, 11450, 11451, 11459, 11460, 11461, 11462, 11463, 11464, 11465, 11466, 11467, 11468, 11472, 11475, 11476, 11479, 11480, 11481, 11482, 11483, 11484, 11485, 11486, 11487, 11488, 11489, 11490, 11491, 11494, 11495, 11499, 11500, 11502, 11508, 11514, 11516, 11517, 11521, 11522, 11523, 11524, 11525, 11526, 11529, 11532, 11533, 11534, 11535, 11536, 11537, 11538, 11539, 11540, 11542, 11547, 12432, 11930, 11885, 11613, 12613, 11555, 11558, 12552, 12666, 12562, 12203, 11566, 11567, 11573, 11574, 11575, 11581, 11577, 11579, 11580, 11656, 11608, 11583, 11584, 11585, 11587, 11588, 11589, 11599, 11598, 11600, 11601, 11602, 11603, 11604, 11605, 11606, 11642, 11609, 11610, 11612, 11615, 11616, 11617, 11618, 12260, 12261, 12262, 11638, 11629, 11643, 11644, 11646, 11647, 11648, 11650, 11653, 11654, 12026, 11659, 11660, 11661, 11662, 11663, 11670, 11672, 11671, 11669, 11673, 11674, 11772, 11770, 11771, 11777, 11778, 11779, 11780, 11784, 11785, 11787, 11791, 11788, 11789, 11790, 11802, 11804, 11805, 11806, 11809, 11818, 11821, 11824, 11834, 11835, 11853, 11858, 11859, 11862, 11955, 11867, 11868, 11869, 11974, 11870, 11876, 11937, 11984, 11980, 11878, 11879, 11899, 11880, 11881, 11882, 11884, 11886, 11887, 11888, 11889, 11890, 11892, 11894, 11895, 11896, 11897, 11898, 11997, 11905, 11906, 11908, 11909, 11910, 11928, 11911, 11912, 11926, 11913, 11925, 11914, 11915, 11918, 11919, 11920, 11921, 11927, 11929, 11931, 11935, 11936, 11938, 11959, 11940, 11941, 11942, 11944, 11945, 12000, 11947, 11949, 11952, 12105, 12001, 12002, 11954, 11960, 11964, 11966, 11970, 11973, 11979, 11981, 11989, 11990, 11991, 12004, 11993, 11995, 12003, 12005, 12006, 12007, 12008, 12009, 12010, 12011, 12012, 12013, 12014, 12015, 12016, 12017, 12021, 12399, 12107, 12061, 12027, 12030, 12035, 12484, 12041, 12042, 12046, 12047, 12048, 12049, 12052, 12053, 12054, 12055, 12056, 12064, 12066, 12089, 12458, 12431, 12096, 12099, 12106, 12111, 12119, 12120, 12124, 12125, 12131, 12132, 12133, 12128, 12129, 12130, 12134, 12135, 12136, 12137, 12138, 12139, 12140, 12141, 12142, 12143, 12342, 12144, 12145, 12176, 12148, 12150, 12152, 12153, 12154, 12155, 12156, 12157, 12158, 12159, 12160, 12161, 12162, 12163, 12164, 12165, 12166, 12167, 12168, 12169, 12170, 12171, 12172, 12173, 12177, 12178, 12179, 12180, 12181, 12182, 12183, 12184, 12335, 12185, 12186, 12187, 12188, 12191, 12199, 12200, 12201, 12205, 12278, 12202, 12204, 12208, 12216, 12211, 12217, 12215, 12218, 12242, 12226, 12228, 12227, 12229, 12233, 12231, 12232, 12241, 12236, 12238, 12239, 12243, 12244, 12245, 12240, 12246, 12247, 12248, 12250, 12253, 12252, 12269, 12264, 12387, 12265, 12270, 12271, 12272, 12273, 12274, 12277, 12279, 12286, 12295, 12290, 12291, 12292, 12296, 12481, 12306, 12309, 12310, 12311, 12312, 12313, 12314, 12315, 12320, 12319, 12321, 12322, 12325, 12329, 12328, 12333, 12332, 12388, 12334, 12612, 12348, 12350, 12355, 12359, 12356, 12361, 12370, 12382, 12383, 12389, 12390, 12391, 12392, 12393, 12396, 12401, 12402, 12403, 12404, 12405, 12412, 12414, 12417, 12427, 12429, 12433, 12443, 12435, 12434, 12436, 12437, 12438, 12439, 12440, 12441, 12442, 12447, 12448, 12449, 12451, 12454, 12459, 12460, 12461, 12462, 12464, 12467, 12473, 12475, 12600, 12482, 12485, 12486, 12487, 12496, 12497, 12498, 12505, 12506, 12523, 12512, 12509, 12514, 12609, 12516, 12517, 12518, 12521, 12522, 12524, 12526, 12529, 12547, 12530, 12531, 12533, 12536, 12537, 12538, 12573, 12575, 12561, 12541, 12545, 12548, 12553, 12555, 12608, 12569, 12576, 12578, 12579, 12589, 12591, 12592, 12593, 12594, 12595, 12597, 12601, 12602, 12607, 12631, 12635, 12637, 12638, 12639, 12641, 12643, 12646, 12649, 12653, 12654, 12655, 12657, 12662, 12663, 12664, 12665, 12667, 12672)
    AND MATCH(index_text) AGAINST('+tenant' IN BOOLEAN MODE)
    #system/user/addons/low_search/libraries/Low_search_filters.php L:145 Low_search_filter_keywords::filter()

    0.0012s
    232KB
    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 (9788) ORDER BY FIELD(t.entry_id, 9788)
    #system/user/addons/low_search/mod.low_search.php L:2009 Channel::entries()

  3. Low 8 Feb 2017 18:38

    From what I can see here, one entry is returned (ID 9788) -- are you expecting more entries to be returned, and if so, which ID should those have?

  4. James Catt 8 Feb 2017 18:59

    Yes, there should be 3 entries returned: 9635, 10807 and 9788.

    I did some digging in the database and found that the missing entries aren't being returned by the second SQL query. field_id_334 is being set to NULL when unchecked, and the LIKE '%yes%' isn't matching them.

    I think that explains why I didn't have this problem under EE2 and why it's only certain entries--the missing entries are ones that have been changed and re-saved under EE3, while the others haven't been modified since we upgraded (so they're still blank). I guess EE2 was setting the field to blank instead of NULL?

    I've noticed that the search parameter is misbehaving with other plugins that it used to work with as well (Solspace Calendar), perhaps this has something to do with it?

  5. Low 8 Feb 2017 19:04

    What happens when you disable the Field Search filter? The search:hide_from_search parameter should then be picked up by EE's native algorithms. Does that give you the correct result?

    (and yeah, EE saving the values as NULL rather than an empty string is causing the issue)

  6. James Catt 8 Feb 2017 19:26

    Sorry, I'm not sure what you mean by disable the Field Search filter -- wouldn't that mean removing the search:hide_from_search parameter?

    PS: I forgot to mention that the debug output I posted is from a template where I have a channel:entries tag next to the low_search tag for comparison. I just looked more closely at the results and realized that the entries aren't showing up there either. I guess this is actually an EE bug then?

  7. Low 8 Feb 2017 19:32

    You can disable the Field Search filter in the Low Search settings in the CP. LS uses its own scripts to further build upon the native search:field parameters, but that particular param would have been handled by the native code when the LS filter is disabled.

    That said, I can see that EE itself generates a WHERE clause like this:

    (field_id_1 NOT LIKE '%foo%')


    which will not return an entry if field_id_1 is NULL. Which could be considered a bug in EE, yes. But because LS has its own code to handle it, it could be considered a bug in LS as well.

    You can work around it, tho. If you change the hide_from_search field to a radiobutton rather than a checkbox, and run this query:

    UPDATE exp_channel_data SET field_id_334 = '' WHERE field_id_334 IS NULL;


    Backup your DB before doing that, just to be on the safe side.

  8. Low 8 Feb 2017 19:36

    Or, changing the parameter to this should also work:

    search:hide_from_search="IS_EMPTY"

  9. James Catt 8 Feb 2017 19:41

    Yeah I was thinking about doing something like that (with the radio button), was just hoping to avoid it.

    And yes, I can confirm that disabling the Field Search filter in the settings has no effect.

    I'll file a bug with Ellis Labs then.

    Thanks for your help!

  10. Low 8 Feb 2017 19:55

    Also fixable in Low Search, by opening up low_search/libraries/Low_search_fields.php and look up line 405, which reads:

    $item = "'{$item}'";


    Replace that with:

    $item = "'{$item}'"; 

    if ($exclude) $item .= " OR {$key} IS NULL";

  11. James Catt 8 Feb 2017 20:21

    That did the trick. You, sir, are a rock star. :)