Go Back   Mosets Community > Archives > Mosets Hot Property 1.0 > Discussions, Troubleshooting and Problems

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-02-2012, 05:35 AM
barrycox8784 barrycox8784 is offline
Mosets'd
 
Join Date: May 2009
Posts: 20
Default advance searches that are too complex hang mysql

in case anyone else runs into this: note that due to the way advance searches are 'phrased' in SQL by hotproperties, each new search term that a user uses effectively doubles the work mysql has to do. so if one term takes a well-tuned mysql .05 sec, using 2 terms adds .10 secs so takes .15 secs and 3 adds .20 and takes .35 secs, etc ... doesn't sound like much but when you're up to using 10 terms, it takes 50 secs, 11 = 2 mins, 12 = 4 mins, etc etc.

since i have 20 terms people can search from, it was theoretically possible for one nasty user to fill in all 20 of them and effectively take down my server with a long search which after 6 years in production, actually happened last week. (side note: not sure why, but other queries weren't going through either... but i couldn't figure out why so i opted for the quick fix below instead)

who in reality needs to query on 20 terms... no one... so instead of re-engineering the SQL or figuring out why other queries were being blocked (and because i didn't want a 4+min query running anyway...), i put the following hack into components/com_hotproperty/views/searches/view.html.php (in case it's of use to anyone else out there since mosets seems to have stopped devel on hot property).

look for the Retreive (sic) datas (sic again) comment and insert the lines below to 'pop-off' any criteria above 8 (for example) from search_fields and then only the first 8 will be used, no matter what people type in.

Code:
/**
* Retreive datas
*/
	
$search_fields = JRequest::getVar('Field', array(), 'get', 'array');
		
if (count($search_fields)>8) JError::raiseWarning( 100, 'Warning: Only first 8 advanced search criteria are considered.' );
while (count($search_fields)>8) { // BVC HACK topop off if there are more that 8 criteria
	array_pop($search_fields);
};

Last edited by barrycox8784; 10-02-2012 at 05:43 AM.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +8. The time now is 06:10 PM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.