![]() |
I think this could really help us bigboards if VB or a VB.org implemented this
http://www.vbulletin.com/forum/showthread.php?t=242202
My forum is very large, and when I enabled the slow_query log in mysql. I noticed that searches that match a large # of posts could take a long time to execute. (this is extremly CPU intensive and causes a downward spiral at times) This is the query that gives me the most trouble, it is in search.php I had to cut out the postids because the query was over 350,000 characters and too large to post here. There was over 40,000 matching postids being passed into that "IN" clause. I do have the search results limit set to 500 in admincp but that does not have any affect on this query. Code:
# Query_time: 16 Lock_time: 0 Rows_sent: 43736 Rows_examined: 87970 If a users search matches over X number of posts, the user could be prompted to refine the query. It would be nice if X this could be an admincp setting, it would stop large #'s of postid's from being passed into that "IN" clause. |
I think I'm looking at the right section in search.php, but might you be able to get a line number for the query that's causing the problem?
|
Wayne said this is the query: https://vborg.vbsupport.ru/showpost....75&postcount=4
I think it would be an easy Add-on: Search.php: Line1296 PHP Code:
If count() of $requiredposts > X prompt user to refine query. This would stop thousands of postid's from being passed to that "IN" clause. |
I'd already played with that, throwing
Code:
if(count($requiredposts > 0)) { |
Line 1296 is not the only place that postids is built into the query logic, see also lines 1050 & 1123.
|
Quote:
PHP Code:
PHP Code:
|
Without looking at it at depth, I think the following would work. Edit your search.php file with the following changes. Be sure to back up your search.php file before doing this, so if it doesn't work right, you can revert to the regular version. Warning: this code is untested.
First define a phrase called searchrefinequery with your error message, maybe: "Your search returned gazillions of posts, try being more specific, thanks". Also, change the number 1000 to whatever suits your fancy. (1) Add this: PHP Code:
PHP Code:
Add this: PHP Code:
PHP Code:
Add this: PHP Code:
PHP Code:
|
All times are GMT. The time now is 11:32 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|