class SearchEngine def self.query(query) #Execute the command command_output = `java Search index/wikidb_quality '#{query}'` #Iterate through the results adding them to the results array results = [] i = 1 command_output.split("\n").each do |f| result = ResultItem.new result.id = i #delimit is manual for now, set in Search.java, note index result.title = f.split('----') result.link = "http://en.wikipedia.org/wiki/#{result.title[0]}" results << result i += 1 #number of results to return break if i>10 end return results end end