Skip Navigation

[Resolved] search/filter not working after import

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 15 replies, has 2 voices.

Last updated by ScottM9386 3 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1688079

Hi,

I have a view with a search with filters. After importing a whole bunch of custom posts it's not working.
I have it set to "Show only available options for each input" which before import worked fine. But after import it shows no options (these filters are for taxonomies) . After a little while of testing the search filter they start to come back, but not all. If I hit reset the options disappear again.
selecting "Always show all values for inputs" seems to show everything but I definitely don't want that.

Thanks.

#1688093

please hide this link
you can see example of problem with empty search dropdowns (taxonomies)
hidden link

#1688919

also I'd like to add... when I create a new view now with pagination (and this is after the import, it was working fine before) selecting "Show only available options for each input" only shows the taxonomy terms for that page, not the entire query as before.

#1688951

Hi, all links are hidden from other non-supporter Users by default in the forum unless you place an "@" symbol before the URL, so it will remain private. You mentioned that it seemed to work okay before importing a bunch of posts. This search option has a performance impact, and it can be impractical to implement on very large sites. There could be a bug, or a configuration issue, so let's try some troubleshooting.
- How many posts is a bunch in this case - a thousand? Ten thousand or more?
- Is the Query Filter set up to query multiple taxonomies using "AND" or "OR"?
- If you temporarily deactivate all other plugins except Types and Views, and activate a default theme like Twenty Twenty, is the behavior of the filters any different?
- Do you have access to server logs? Can you check to see if any server-side errors are logged while testing the View filters? If you're not familiar with server logs, I can show you how to activate them temporarily. Go in your wp-config.php file and look for

define('WP_DEBUG', false);

Change it to:

define('WP_DEBUG', true);

Then add these lines, just after the WP_DEBUG line:

define('WP_DEBUG_LOG', dirname(__FILE__) . '/error_log.txt');
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
define('WP_DISABLE_FATAL_ERROR_HANDLER',true);

Test the View's filters for a minute or two by making various selections and submitting the filters. If any server-side errors are triggered during this process, it will create an error_log.txt file in your site's root directory. Use FTP to look for this file in the same directory as wp-config.php. You may need to click "Refresh" in your FTP browser to see a new file appear. Please download this file to your computer, open it in any text editing software, and send me its contents. Once that is done, you can revert the changes you made to wp-config.php and delete the log file using FTP.

#1688959

Hi Christian,

Thank you for your response.
"This search option has a performance impact, and it can be impractical to implement on very large sites." - wow, that's a drag!

1. I imported 3000 posts and was hoping to import another 2000
2. the search form for this particular view (hidden link) has 3 taxonomy in "and" relationship
3. deactivating plugins etc....I will get back to you on that.
4. I'm on wpengine so I have error logs: here's what I found from recent query....KILLED QUERY (I assume the below will remain hidden on this forum)
EDIT - sensitive data removed here
KILLED QUERY (18410 characters long generated in /path/to/site/wp-content/plugins/wp-views/embedded/inc/classes/wpv-cache.class.php:284): SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('genre', 'track-mix', 'instrument') AND tr.object_id IN (4334, 4335, 4338, 4402, 4406, 4410, 4407, 4403, 4411, 4412, 4413, 4414, 4352, 4417, 4348, 4351, 4345, 4349, 4423, 4350, 4346, 4424, 4425, 4426, 4427, 4435, 4430, 4431, 4434, 4428, 4432, 4436, 4433, 4429, 4437, 4438, 4439, 4440, 4448, 4443, 4444, 4447, 4441, 4445, 4449, 4446, 4442, 4450, 4516, 4517, 4518, 4526, 4521, 4522, 4525, 4519, 4523, 4527, 4524, 4520, 4528, 4529, 4530, 4531, 4539, 4534, 4535, 4538, 4532, 4536, 4540, 4537, 4533, 4541, 4542, 4543, 4544, 4552, 4547, 4548, 4551, 4545, 4549, 4553, 4550, 4546, 4554, 4555, 4556, 4557, 4565, 4560, 4561, 4564, 4558, 4562, 4566, 4563, 4559, 4567, 4568, 4569, 4570, 4578, 4573, 4574, 4577, 4571, 4575, 4579, 4576, 4572, 4580, 4581, 4582, 4583, 4591, 4586, 4587, 4590, 4584, 4588, 4592, 4589, 4585, 4593, 4594, 4595, 4596, 4604, 4599, 4600, 4603, 4597, 4601, 4605, 4602, 4598, 4606, 4607, 4608, 4609, 4617, 4612, 4613, 4616, 4610, 4614, 4618, 4615, 4611, 4619, 4620, 4621, 4622, 4630, 4625, 4626, 4629, 4623, 4627, 4631, 4628, 4624, 4632, 4633, 4634, 4635, 4643, 4638, 4639, 4642, 4636, 4640, 4644, 4641, 4637, 4645, 4646, 4647, 4648, 4656, 4651, 4652, 4655, 4649, 4653, 4657, 4654, 4650, 4658, 4659, 4660, 4661, 4669, 4664, 4665, 4668, 4662, 4666, 4670, 4667, 4663, 4671, 4672, 4673, 4674, 4682, 4677, 4678, 4681, 4675, 4679, 4683, 4680, 4676, 4684, 4685, 4686, 4687, 4695, 4690, 4691, 4694, 4688, 4692, 4696, 4693, 4689, 4697, 4698, 4699, 4700, 4708, 4703, 4704, 4707, 4701, 4705, 4709, 4706, 4702, 4710, 4711, 4712, 4713, 4721, 4716, 4717, 4720, 4714, 4718, 4722, 4719, 4715, 4723, 4724, 4725, 4726, 4734, 4729, 4730, 4733, 4727, 4731, 4735, 4732, 4728, 4736, 4737, 4738, 4739, 4747, 4742, 4743, 4746, 4740, 4744, 4748, 4745, 4741, 4749, 1021, 236, 4750, 4751, 4752, 4760, 4755, 4756, 4759, 4753, 4757, 4761, 4758, 4754, 4762, 4763, 4764, 4765, 4773, 4768, 4769, 4772, 4766, 4770, 4774, 4771, 4767, 4775, 4776, 4777, 4778, 4786, 4781, 4782, 4785, 4779, 4783, 4787, 4784, 4780, 4788, 4789, 4790, 4791, 4799, 4794, 4795, 4798, 4792, 4796, 4800, 4797, 4793, 4801, 4802, 4803, 4804, 4812, 4807, 4808, 4811, 4805, 4809, 4813, 4810, 4806, 4814, 4815, 4816, 4817, 4825, 4820, 4821, 4824, 4818, 4822, 4826, 4823, 4819, 4827, 4828, 4829, 4830, 4838, 4833, 4834, 4837, 4831, 4835, 4839, 4836, 4832, 4840, 4841, 4842, 4843, 4851, 4846, 4847, 4850, 4844, 4848, 4852, 4849, 4845, 4853, 4854, 4855, 4856, 4864, 4859, 4860, 4863, 4857, 4861, 4865, 4862, 4858, 4866, 4867, 4868, 4869, 4877, 4872, 4873, 4876, 4870, 4874, 4878, 4875, 4871, 4879, 4880, 4881, 4882, 4890, 4885, 4886, 4889, 4883, 4887, 4891, 4888, 4884, 4892, 4893, 4894, 4895, 4903, 4898, 4899, 4902, 4896, 4900, 4904, 4901, 4897, 4905, 4906, 4907, 4908, 4916, 4911, 4912, 4915, 4909, 4913, 4917, 4914, 4910, 4918, 4919, 4920, 4921, 4929, 4924, 4925, 4928, 4922, 4926, 4930, 4927, 4923, 4931, 4932, 4933, 4934, 4942, 4937, 4938, 4941, 4935, 4939, 4943, 4940, 4936, 4944, 4945, 4946, 4947, 4955, 4950, 4951, 4954, 4948, 4952, 4956, 4953, 4949, 4957, 4958, 4959, 4960, 4968, 4963, 4964, 4967, 4961, 4965, 4969, 4966, 4962, 4970, 4971, 4972, 4973, 4981, 4976, 4977, 4980, 4974, 4978, 4982, 4979, 4975, 4983, 2141, 4490, 4491, 4492, 4500, 4495, 4496, 4499, 4493, 4497, 4501, 4498, 4494, 4502, 4984, 4985, 4986, 4994, 4989, 4990, 4993, 4987, 4991, 4995, 4992, 4988, 4996, 4997, 4998, 4999, 5007, 5002, 5003, 5006, 5000, 5004, 5008, 5005, 5001, 5009, 5010, 5011, 5012, 5020, 5015, 5016, 5019, 5013, 5017, 5021, 5018, 5014, 5022, 5023, 5024, 5025, 5033, 5028, 5029, 5032, 5026, 5030, 5034, 5031, 5027, 5035, 5036, 5037, 5038, 5046, 5041, 5042, 5045, 5039, 5043, 5047, 5044, 5040, 5048, 5049, 5050, 5051, 5059, 5054, 5055, 5058, 5052, 5056, 5060, 5057, 5053, 5061, 5062, 5063, 5064, 5072, 5067, 5068, 5071, 5065, 5069, 5073, 5070, 5066, 5074, 5075, 5076, 5077, 5085, 5080, 5081, 5084, 5078, 5082, 5086, 5083, 5079, 5087, 5088, 5089, 5090, 5098, 5093, 5094, 5097, 5091, 5095, 5099, 5096, 5092, 5100, 5101, 5102, 5103, 5111, 5106, 5107, 5110, 5104, 5108, 5112, 5109, 5105, 5113, 5114, 5115, 5116, 5124, 5119, 5120, 5123, 5117, 5121, 5125, 5122, 5118, 5126, 5127, 5128, 5129, 5137, 5132, 5133, 5136, 5130, 5134, 5138, 5135, 5131, 5139, 5140, 5141, 5142, 5150, 5145, 5146, 5149, 5143, 5147, 5151, 5148, 5144, 5152, 5153, 5154, 5155, 5163, 5158, 5159, 5162, 5156, 5160, 5164, 5161, 5157, 5165, 5166, 5167, 5168, 5176, 5171, 5172, 5175, 5169, 5173, 5177, 5174, 5170, 5178, 5179, 5180, 5181, 5189, 5184, 5185, 5188, 5182, 5186, 5190, 5187, 5183, 5191, 5192, 5193, 5194, 5202, 5197, 5198, 5201, 5195, 5199, 5203, 5200, 5196, 5204, 5205, 5206, 5207, 5215, 5210, 5211, 5214, 5208, 5212, 5216, 5213, 5209, 5217, 5218, 5219, 5220, 5228, 5223, 5224, 5227, 5221, 5225, 5229, 5226, 5222, 5230, 5231, 5232, 5233, 5241, 5236, 5237, 5240, 5234, 5238, 5242, 5239, 5235, 5243, 5244, 5245, 5246, 5254, 5249, 5250, 5253, 5247, 5251, 5255, 5252, 5248, 5256, 5257, 5258, 5259, 5267, 5262, 5263, 5266, 5260, 5264, 5268, 5265, 5261, 5269, 5270, 5271, 5272, 5280, 5275, 5276, 5279, 5273, 5277, 5281, 5278, 5274, 5282, 5283, 5284, 5285, 5293, 5288, 5289, 5292, 5286, 5290, 5294, 5291, 5287, 5295, 5296, 5297, 5298, 5306, 5301, 5302, 5305, 5299, 5303, 5307, 5304, 5300, 5308, 5309, 5310, 5311, 5319, 5314, 5315, 5318, 5312, 5316, 5320, 5317, 5313, 5321, 5322, 5323, 5324, 5332, 5327, 5328, 5331, 5325, 5329, 5333, 5330, 5326, 5334, 3593, 5335, 5336, 5337, 5345, 5340, 5341, 5344, 5338, 5342, 5346, 5343, 5339, 5347, 5348, 5349, 5350, 5358, 5353, 5354, 5357, 5351, 5355, 5359, 5356, 5352, 5360, 5361, 5362, 5363, 5371, 5366, 5367, 5370, 5364, 5368, 5372, 5369, 5365, 5373, 5374, 5375, 5376, 5384, 5379, 5380, 5383, 5377, 5381, 5385, 5382, 5378, 5386, 5387, 5388, 5389, 5397, 5392, 5393, 5396, 5390, 5394, 5398, 5395, 5391, 5399, 5400, 5401, 5402, 5410, 5405, 5406, 5409, 5403, 5407, 5411, 5408, 5404, 5412, 5413, 5414, 5415, 5423, 5418, 5419, 5422, 5416, 5420, 5424, 5421, 5417, 5425, 5426, 5427, 5428, 5436, 5431, 5432, 5435, 5429, 5433, 5437, 5434, 5430, 5438, 5439, 5440, 5441, 5449, 5444, 5445, 5448, 5442, 5446, 5450, 5447, 5443, 5451, 5452, 5453, 5454, 5462, 5457, 5458, 5461, 5455, 5459, 5463, 5460, 5456, 5464, 5465, 5466, 5467, 5475, 5470, 5471, 5474, 5468, 5472, 5476, 5473, 5469, 5477, 5478, 5479, 5480, 5488, 5483, 5484, 5487, 5481, 5485, 5489, 5486, 5482, 5490, 5491, 5492, 5493, 5501, 5496, 5497, 5500, 5494, 5498, 5502, 5499, 5495, 5503, 5504, 5505, 5506, 5514, 5509, 5510, 5513, 5507, 5511, 5515, 5512, 5508, 5516, 5517, 5518, 5519, 5527, 5522, 5523, 5526, 5520, 5524, 5528, 5525, 5521, 5529, 5530, 5531, 5532, 5540, 5535, 5536, 5539, 5533, 5537, 5541, 5538, 5534, 5542, 5543, 5544, 5545, 5553, 5548, 5549, 5552, 5546, 5550, 5554, 5551, 5547, 5555, 5556, 5557, 5558, 5566, 5561, 5562, 5565, 5559, 5563, 5567, 5564, 5560, 5568, 5569, 5570, 5571, 5579, 5574, 5575, 5578, 5572, 5576, 5580, 5577, 5573, 5581, 5582, 5583, 5584, 5592, 5587, 5588, 5591, 5585, 5589, 5593, 5590, 5586, 5594, 5595, 5596, 5597, 5605, 5600, 5601, 5604, 5598, 5602, 5606, 5603, 5599, 5607, 5608, 5609, 5610, 5618, 5613, 5614, 5617, 5611, 5615, 5619, 5616, 5612, 5620, 5621, 5622, 5623, 5631, 5626, 5627, 5630, 5624, 5628, 5632, 5629, 5625, 5633, 5634, 5635, 5636, 5644, 5639, 5640, 5643, 5637, 5641, 5645, 5642, 5638, 5646, 5647, 5648, 5649, 5657, 5652, 5653, 5656, 5650, 5654, 5658, 5655, 5651, 5659, 5660, 5661, 5662, 5670, 5665, 5666, 5669, 5663, 5667, 5671, 5668, 5664, 5672, 5673, 5674, 5675, 5683, 5678, 5679, 5682, 5676, 5680, 5684, 5681, 5677, 5685, 5686, 5687, 5688, 5696, 5691, 5692, 5695, 5689, 5693, 5697, 5694, 5690, 5698, 5699, 5700, 5701, 5709, 5704, 5705, 5708, 5702, 5706, 5710, 5707, 5703, 5711, 5712, 5713, 5714, 5717, 5718, 5715, 5716, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733,

#1689421

Okay thanks, I removed some private-ish data from the error log. Unfortunately it seems the issue here is the number of posts and terms contributing to a long, complex query. For each search filter, we query the database to determine which options should appear in the filter list, such that selecting any option along with the other currently selected options will produce results. The database is complaining and canceling the query for some reason. That kind of explains why you start seeing some options appear in some term filters after you add other term filters (which decreases the number of selected term IDs that must be included in the query), but then if you reset the query the options disappear again (the number of term IDs in the query increases again).

I know wpengine does some proprietary backend stuff to help speed up queries and WP performance in general. Since that part is out of my control, it might be helpful for you to ask their support team to help assess why the query was killed - memory issue? Query character length issue? Query duration issue? Query caching issue?

Ideally what I would do at this point is create a clone of the site and try to reproduce the issue on my own local environment, where I can monitor code execution and database performance real-time. However, you've got a multisite environment, which makes the process more complicated, and wpengine is a bit restrictive in terms of the ways you can access the server to create site clones. I have Duplicator Pro, which helps solve some of these problems, and allows you to create a clone of a single site in a multisite environment and deploy it as a standalone site somewhere else. If it's okay with you, I'd like to try to use that plugin to create a clone and run some tests. If you approve, please provide login credentials here and I'll try to make that clone.

#1689467

Hi Christian,

Thank you for all the great info.
Let me check with wpengine. The "duplicator" plugin is one of the dis-allowed plugins on wpengine. Not sure if dulicator Pro is the same thing. I want to check with them. I will likewise check about the other questions with them tomorrow.

Thank you!
Scott.

#1690617

Hi Christian,

So I talked to wpengine support and they say the query is not being killed on their end. And what's REALLY bizzare is when he looked at the page with the view and search form it appeared normal! (the "genres" dropdown (a taxonomy) was NOT empty)
Do "genre" terms appear for you in the below link in the search form dropdown?
hidden link

I've tested in 3 browsers, some private and on a computer that's never visited the site (connected by Ethernet) the others are wireless connection) and for me the "genre" dropdown in the search form is empty.
I don't get it.
They said you can install duplicator PRO and get the site. I can also get a zip file from them that they said should have all the data you need.
Let me know next steps.
Thank you!
Scott.

#1690657

For me, genre is always empty unless another filter is selected. So maybe he was visiting a link that had another search filter selected already, like hidden link ? I'm not sure though. Maybe it's different for logged-in and logged-out Users? If you'll provide admin login I will take a closer look and use the Duplicator Pro plugin to create the site clone. The login credentials I have from a previous ticket are no longer working.

#1690819

Okay, I made a site clone and the filters seem to work correctly on my local tests, indicating a server-side issue that will be difficult to troubleshoot given your setup. So I did a bit more digging and I can see that this page was built using a Content Template inserted in a Beaver Builder page design. I checked the Content Template and I can see the source code:

<div class="row">
	<div class="col-sm-3"><div class="searchcatalogborder">[wpv-form-view name="catalog-tv-film-music" target_id="self"]</div>

</div>
	<div class="col-sm-9">[wpv-view name="catalog-tv-film-music" view_display="layout"]</div>
</div>

This might be part of the problem. Basically you've split the filters and the results here with two shortcodes so you can display the filters and results in two columns. That's a bit unnecessary, and may be causing some unnecessary database calls. Instead, edit the View and scroll all the way down to the bottom Output Editor panel. Build the same column structure here using the wpv-filter-meta-html and wpv-layout-meta-html shortcodes to represent the filters and results, respectively:

<div class="row">
	<div class="col-sm-3"><div class="searchcatalogborder">[wpv-filter-meta-html ]</div>

</div>
	<div class="col-sm-9">[wpv-layout-meta-html]</div>
</div>

Then edit the Beaver Builder design and instead of the Content Template shortcode, directly place the View shortcode to eliminate the need for an extra Content Template:

[wpv-view name="catalog-tv-film-music"]

This will help cut down on the server load because in the current setup, the View's filters are actually rendered twice on the page and both sets of filters trigger calls to the database for updates whenever a filter is changed. That's an unnecessary duplication, and might be contributing to the problem here. I suggest making this modification to see if it improves the performance of the View filters, before we go any further. FYI the User you created for me doesn't have access to the demosite subsite for some reason despite having superuser access to the network.

#1690859

Hi Christian,

Thank you for all your help. Well, it's better, slightly. However, now it shows only the genre terms for that page. Navigate to the next page and it shows only genre terms only for that page. Previously, when there were far fewer posts, it would show the terms for all posts within the view, which is how it's supposed to work right?

" FYI the User you created for me doesn't have access to the demosite" - strange, I tested it before I sent it to you. I just logged into it with the login creds I sent you - hidden link

Thanks again. I hope we can get this straightened out. Toolset advertises building classified and real estate sites using views. Such sites surely have 1000's of posts, so it should work, right?

#1691813

Christian, please check this out....
I'd first rather see if the query can be optimized rather then using the proposed solution in this doc.
hidden link

#1692031

update...adding the following to the site’s wp-config.php: define( 'WPE_GOVERNOR', false );
fixed the problem for anyone else on wpengine.
However, just curious if there's any further optimization I might be able to do?
Also - I was testing out search and filter plugin (before adding above to config file) and it was functioning as expected, showing only terms connected to posts published, and displaying results correctly. Any thoughts on why this might be so but not work correctly with the view search?
Thanks!

#1692297

I'd first rather see if the query can be optimized rather then using the proposed solution in this doc.
Okay sure, I can ask my 2nd tier support team to look. From a front-end perspective I don't see anything else to do to optimize the implementation - we've eliminated some duplication by changing the way the View was placed on the site but there isn't anything else obvious. It's going to take time, so implementing the solution described there is probably a good thing in the near term to get search working.

Also - I was testing out search and filter plugin (before adding above to config file) and it was functioning as expected, showing only terms connected to posts published, and displaying results correctly. Any thoughts on why this might be so but not work correctly with the view search?
Not ofhand, I'm not really familiar with this plugin, or how it structures its queries. It could have a more efficient algorithm for building complex queries with multiple taxonomies and other custom fields. Hard to say offhand without an in-depth technical analysis.

What about the terms being effected by pagination - are you saying the paginated term issue was solved, or that still a problem?

#1693011

I implemented wp-config.php: define( 'WPE_GOVERNOR', false ); and it solved the problem - yes "paginated term issue was solved"
Another question for me has arisen through our conversation, but it's really a separate issue, should I open a different ticket?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.