FIX: Bug with search
This commit is contained in:
		
							parent
							
								
									e7359a118b
								
							
						
					
					
						commit
						9ecad98b17
					
				|  | @ -16,10 +16,14 @@ after_initialize do | |||
|     if Search.respond_to? :advanced_filter | ||||
|       Search.advanced_filter(/in:kb/) do |posts| | ||||
|         selected_categories = SiteSetting.knowledge_explorer_categories.split("|") | ||||
|         if selected_categories | ||||
|           categories = Category.where('id IN (?)', selected_categories).pluck(:id) | ||||
|         end | ||||
| 
 | ||||
|         selected_tags = SiteSetting.knowledge_explorer_tags.split("|") | ||||
|         if selected_tags | ||||
|           tags = Tag.where('name IN (?)', selected_tags).pluck(:id) | ||||
|         end | ||||
| 
 | ||||
|         posts.where('category_id IN (?) OR topics.id IN (SELECT DISTINCT(tt.topic_id) FROM topic_tags tt WHERE tt.tag_id IN (?))', categories, tags) | ||||
|       end | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue