nytimes-articles icon indicating copy to clipboard operation
nytimes-articles copied to clipboard

Text arguments are split by space incorrectly.

Open iros opened this issue 14 years ago • 0 comments

When attempting to perform a search with a text field argument such as :author => 'steven lee myer' in article.rb you split that to result in the query looking like: author=steven&author=lee&author=myers

This is because of the method text_argument(field, argument) which takes a term and slices it:

def self.text_argument(field, argument) arg = argument.dup subquery = [] while term = arg.slice!(%r{("[^"]+")|\S+}) if term =~ /^-/ subquery << "-#{field}:#{term[1..term.length]}" else subquery << "#{field}:#{term}" end end

subquery.join(' ')

end

I am not sure what the purpose of that operation is... I have removed it in my source version to get things working.

iros avatar Oct 14 '10 15:10 iros