Created
December 31, 2010 05:35
-
-
Save dbasch/760759 to your computer and use it in GitHub Desktop.
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
require 'rubygems' | |
require 'indextank' | |
url = 'http://:T9a+hLm76n+KgH@2834u.api.indextank.com' | |
api = IndexTank::Client.new url | |
index = api.indexes('test') | |
threads = [] | |
text = "this /as3<<<<!>#!$%!$<<lis a test ta<Q@#L$#<!!!34lkj 431<!//1lkj4> lskfj o...43lk1j 988181<,G$?5ly?H>>>5//2\\\4\33...43''''/////ke it "# * 2000 | |
500.times do |t| | |
Thread.new(t) do | |
while true | |
begin | |
id = rand(1000000) | |
r = index.document(id).add({:title=>"jQuery Reference Guide", :page=>61, :text=>"DOM Traversal Methods\n\nParameters\n• text: A string of text to search for\n\nReturn Value\nThe new jQuery object.\n\nDescription\nGiven a jQuery object that represents a set of DOM elements, the .contains method constructs a new jQuery object from a subset of the matching elements. The supplied text is searched for in each element; all elements containing the text (even within a descendant element) will be included in the result. Consider a page with a simple list on it:\n<ul> <li>list <li>list <li>list <li>list <li>list </ul> item 1</li> <strong>item</strong> 2</li> item 3</li> item 4</li> item 5</li>\n\nWe can apply this method to the set of list items:\n$('li').contains('item 2')\n\nThe result of this call is a jQuery object wrapping item 2, as it contains the specified text. The search is performed using jQuery's .text method, so the search text can be located anywhere within the concatenation of the text strings in the matched set of elements or any of their descendants.\n\n.eq()\nReduces the set of matched elements to the one at the specified index. .eq(index)\n\nParameters\n• index: An integer indicating the 0-based position of the element\n\nReturn Value\nThe new jQuery object.\n[ 44 ]\n\n\f", :isbn=>"9781847193810", :author=>"not found", :cover=>"notfound.png"}) | |
printf "%d %d\n", t, r | |
rescue e | |
puts e | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment