+ posts_by_author = Post.get_id_by_posters(users)
+ end
+ if params.key?(:keywords) and !params[:keywords].blank?
+ if %w(all message).include? params[:search_in]
+ posts_by_message = Post.find_id_by_contents(params[:keywords])
+ posts_by_message.map! {|x| x[:id].to_i}
+ end
+ if %w(all topic).include? params[:search_in]
+ topics = Topic.find_id_by_contents(params[:keywords])
+ topics.map! {|x| x[:id].to_i}
+ end
+ end
+ if posts_by_message.nil? or posts_by_author.nil?
+ posts = posts_by_author || posts_by_message
+ else
+ posts = posts_by_author & posts_by_message