Created
August 28, 2013 09:14
-
-
Save panmari/6363953 to your computer and use it in GitHub Desktop.
Starting two queries to the elasticsearch server through the Tire gem. Even though the long, complicated query starts before the short one, the short one is returned first.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# try this in a rails environment, that has the Indexing module loaded. (medcode, orangeproton) | |
search_queries = ["Ein sehr komplizierter query, der sehr lange zum ausfuhren braucht", "kurz"] # !sic | |
threads = [] | |
search_queries.each do |string| | |
threads << Thread.new(string) do |query| | |
puts "started #{query}" | |
Indexing.elastic_find_all(string, 'icd', '2012', 'ch', 'de') | |
puts "finished #{query}" | |
end | |
end | |
threads.each { |t| t.join } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output (with corrected newlines):