All subqueries in tag searches are now reformed. Further SQL improvements
This commit is contained in:
		
					parent
					
						
							
								759015e5fd
							
						
					
				
			
			
				commit
				
					
						eaefcf9de7
					
				
			
		
					 5 changed files with 57 additions and 38 deletions
				
			
		| 
						 | 
				
			
			@ -191,9 +191,14 @@ function content_content(&$a, $update = 0) {
 | 
			
		|||
		}*/
 | 
			
		||||
 | 
			
		||||
		if($tag) {
 | 
			
		||||
			$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
 | 
			
		||||
				dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
 | 
			
		||||
			$sql_table = "`term` LEFT JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
 | 
			
		||||
			//$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
 | 
			
		||||
			//	dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
 | 
			
		||||
			//$sql_table = "`term` LEFT JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
 | 
			
		||||
 | 
			
		||||
			$sql_extra = "";
 | 
			
		||||
			$sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
 | 
			
		||||
				dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(local_user()));
 | 
			
		||||
 | 
			
		||||
		} else {
 | 
			
		||||
			if (get_config('system','use_fulltext_engine'))
 | 
			
		||||
				$sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue