def filter_string(filter = {}, array_join = nil)
      filter.inject('') do |mem, kv|
        key, value = kv
        if value.is_a?(Array)
          if !array_join.nil?
            mem += value.inject('') { |m, v|
              v = "\"#{v}\"" if v.to_s.include?(' ')
              m+= "#{key}:#{v}"
            }
            return mem
          else
            value = value.join(array_join)
          end
        end
        value = "\"#{value}\"" if value.to_s.include?(' ')
        mem += "#{key}:#{value} "
      end
    end
def filter_string(filter = {}, array_join = nil)
      filter.inject('') do |mem, kv|
        key, value = kv
        if value.is_a?(Array)
          if !array_join.nil?
            mem += value.inject('') { |m, v|
              v = "\"#{v}\"" if v.to_s.include?(' ')
              m+= "#{key}:#{v}"
            }
            return mem
          else
            value = value.join(array_join)
          end
        end
        value = "\"#{value}\"" if value.to_s.include?(' ')
        mem += "#{key}:#{value} "
      end
    end
Returns a filter-like string from a hash
 If array_join is given, arrays are joined rather than having their own separated key:values

 ex: filter_string({:name => 'some value', :tags => ['abc', 'def']}) = "name:'some value' tag:abc tag:def"