riddle 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +8 -5
  3. data/Gemfile +10 -0
  4. data/HISTORY +4 -0
  5. data/README.markdown +1 -1
  6. data/lib/riddle.rb +1 -0
  7. data/lib/riddle/0.9.9/configuration/searchd.rb +1 -1
  8. data/lib/riddle/client.rb +4 -1
  9. data/lib/riddle/client/message.rb +15 -14
  10. data/lib/riddle/configuration/parser.rb +1 -0
  11. data/lib/riddle/configuration/section.rb +9 -9
  12. data/lib/riddle/configuration/source.rb +5 -5
  13. data/lib/riddle/query/select.rb +3 -2
  14. data/riddle.gemspec +2 -4
  15. metadata +4 -329
  16. data/spec/fixtures/.gitignore +0 -2
  17. data/spec/fixtures/data/0.9.9/anchor.bin +0 -0
  18. data/spec/fixtures/data/0.9.9/any.bin +0 -0
  19. data/spec/fixtures/data/0.9.9/boolean.bin +0 -0
  20. data/spec/fixtures/data/0.9.9/comment.bin +0 -0
  21. data/spec/fixtures/data/0.9.9/distinct.bin +0 -0
  22. data/spec/fixtures/data/0.9.9/field_weights.bin +0 -0
  23. data/spec/fixtures/data/0.9.9/filter.bin +0 -0
  24. data/spec/fixtures/data/0.9.9/filter_array.bin +0 -0
  25. data/spec/fixtures/data/0.9.9/filter_array_exclude.bin +0 -0
  26. data/spec/fixtures/data/0.9.9/filter_boolean.bin +0 -0
  27. data/spec/fixtures/data/0.9.9/filter_floats.bin +0 -0
  28. data/spec/fixtures/data/0.9.9/filter_floats_exclude.bin +0 -0
  29. data/spec/fixtures/data/0.9.9/filter_range.bin +0 -0
  30. data/spec/fixtures/data/0.9.9/filter_range_exclude.bin +0 -0
  31. data/spec/fixtures/data/0.9.9/group.bin +0 -0
  32. data/spec/fixtures/data/0.9.9/index.bin +0 -0
  33. data/spec/fixtures/data/0.9.9/index_weights.bin +0 -0
  34. data/spec/fixtures/data/0.9.9/keywords_with_hits.bin +0 -0
  35. data/spec/fixtures/data/0.9.9/keywords_without_hits.bin +0 -0
  36. data/spec/fixtures/data/0.9.9/overrides.bin +0 -0
  37. data/spec/fixtures/data/0.9.9/phrase.bin +0 -0
  38. data/spec/fixtures/data/0.9.9/rank_mode.bin +0 -0
  39. data/spec/fixtures/data/0.9.9/select.bin +0 -0
  40. data/spec/fixtures/data/0.9.9/simple.bin +0 -0
  41. data/spec/fixtures/data/0.9.9/sort.bin +0 -0
  42. data/spec/fixtures/data/0.9.9/update_simple.bin +0 -0
  43. data/spec/fixtures/data/0.9.9/weights.bin +0 -0
  44. data/spec/fixtures/data/1.10/anchor.bin +0 -0
  45. data/spec/fixtures/data/1.10/any.bin +0 -0
  46. data/spec/fixtures/data/1.10/boolean.bin +0 -0
  47. data/spec/fixtures/data/1.10/comment.bin +0 -0
  48. data/spec/fixtures/data/1.10/distinct.bin +0 -0
  49. data/spec/fixtures/data/1.10/field_weights.bin +0 -0
  50. data/spec/fixtures/data/1.10/filter.bin +0 -0
  51. data/spec/fixtures/data/1.10/filter_array.bin +0 -0
  52. data/spec/fixtures/data/1.10/filter_array_exclude.bin +0 -0
  53. data/spec/fixtures/data/1.10/filter_boolean.bin +0 -0
  54. data/spec/fixtures/data/1.10/filter_floats.bin +0 -0
  55. data/spec/fixtures/data/1.10/filter_floats_exclude.bin +0 -0
  56. data/spec/fixtures/data/1.10/filter_range.bin +0 -0
  57. data/spec/fixtures/data/1.10/filter_range_exclude.bin +0 -0
  58. data/spec/fixtures/data/1.10/group.bin +0 -0
  59. data/spec/fixtures/data/1.10/index.bin +0 -0
  60. data/spec/fixtures/data/1.10/index_weights.bin +0 -0
  61. data/spec/fixtures/data/1.10/keywords_with_hits.bin +0 -0
  62. data/spec/fixtures/data/1.10/keywords_without_hits.bin +0 -0
  63. data/spec/fixtures/data/1.10/overrides.bin +0 -0
  64. data/spec/fixtures/data/1.10/phrase.bin +0 -0
  65. data/spec/fixtures/data/1.10/rank_mode.bin +0 -0
  66. data/spec/fixtures/data/1.10/select.bin +0 -0
  67. data/spec/fixtures/data/1.10/simple.bin +0 -0
  68. data/spec/fixtures/data/1.10/sort.bin +0 -0
  69. data/spec/fixtures/data/1.10/update_simple.bin +0 -0
  70. data/spec/fixtures/data/1.10/weights.bin +0 -0
  71. data/spec/fixtures/data/2.0.1/anchor.bin +0 -0
  72. data/spec/fixtures/data/2.0.1/any.bin +0 -0
  73. data/spec/fixtures/data/2.0.1/boolean.bin +0 -0
  74. data/spec/fixtures/data/2.0.1/comment.bin +0 -0
  75. data/spec/fixtures/data/2.0.1/distinct.bin +0 -0
  76. data/spec/fixtures/data/2.0.1/field_weights.bin +0 -0
  77. data/spec/fixtures/data/2.0.1/filter.bin +0 -0
  78. data/spec/fixtures/data/2.0.1/filter_array.bin +0 -0
  79. data/spec/fixtures/data/2.0.1/filter_array_exclude.bin +0 -0
  80. data/spec/fixtures/data/2.0.1/filter_boolean.bin +0 -0
  81. data/spec/fixtures/data/2.0.1/filter_floats.bin +0 -0
  82. data/spec/fixtures/data/2.0.1/filter_floats_exclude.bin +0 -0
  83. data/spec/fixtures/data/2.0.1/filter_range.bin +0 -0
  84. data/spec/fixtures/data/2.0.1/filter_range_exclude.bin +0 -0
  85. data/spec/fixtures/data/2.0.1/group.bin +0 -0
  86. data/spec/fixtures/data/2.0.1/index.bin +0 -0
  87. data/spec/fixtures/data/2.0.1/index_weights.bin +0 -0
  88. data/spec/fixtures/data/2.0.1/keywords_with_hits.bin +0 -0
  89. data/spec/fixtures/data/2.0.1/keywords_without_hits.bin +0 -0
  90. data/spec/fixtures/data/2.0.1/overrides.bin +0 -0
  91. data/spec/fixtures/data/2.0.1/phrase.bin +0 -0
  92. data/spec/fixtures/data/2.0.1/rank_mode.bin +0 -0
  93. data/spec/fixtures/data/2.0.1/select.bin +0 -0
  94. data/spec/fixtures/data/2.0.1/simple.bin +0 -0
  95. data/spec/fixtures/data/2.0.1/sort.bin +0 -0
  96. data/spec/fixtures/data/2.0.1/update_simple.bin +0 -0
  97. data/spec/fixtures/data/2.0.1/weights.bin +0 -0
  98. data/spec/fixtures/data/2.1.0/anchor.bin +0 -0
  99. data/spec/fixtures/data/2.1.0/any.bin +0 -0
  100. data/spec/fixtures/data/2.1.0/boolean.bin +0 -0
  101. data/spec/fixtures/data/2.1.0/comment.bin +0 -0
  102. data/spec/fixtures/data/2.1.0/distinct.bin +0 -0
  103. data/spec/fixtures/data/2.1.0/field_weights.bin +0 -0
  104. data/spec/fixtures/data/2.1.0/filter.bin +0 -0
  105. data/spec/fixtures/data/2.1.0/filter_array.bin +0 -0
  106. data/spec/fixtures/data/2.1.0/filter_array_exclude.bin +0 -0
  107. data/spec/fixtures/data/2.1.0/filter_boolean.bin +0 -0
  108. data/spec/fixtures/data/2.1.0/filter_floats.bin +0 -0
  109. data/spec/fixtures/data/2.1.0/filter_floats_exclude.bin +0 -0
  110. data/spec/fixtures/data/2.1.0/filter_range.bin +0 -0
  111. data/spec/fixtures/data/2.1.0/filter_range_exclude.bin +0 -0
  112. data/spec/fixtures/data/2.1.0/group.bin +0 -0
  113. data/spec/fixtures/data/2.1.0/index.bin +0 -0
  114. data/spec/fixtures/data/2.1.0/index_weights.bin +0 -0
  115. data/spec/fixtures/data/2.1.0/keywords_with_hits.bin +0 -0
  116. data/spec/fixtures/data/2.1.0/keywords_without_hits.bin +0 -0
  117. data/spec/fixtures/data/2.1.0/overrides.bin +0 -0
  118. data/spec/fixtures/data/2.1.0/phrase.bin +0 -0
  119. data/spec/fixtures/data/2.1.0/rank_mode.bin +0 -0
  120. data/spec/fixtures/data/2.1.0/select.bin +0 -0
  121. data/spec/fixtures/data/2.1.0/simple.bin +0 -0
  122. data/spec/fixtures/data/2.1.0/sort.bin +0 -0
  123. data/spec/fixtures/data/2.1.0/update_simple.bin +0 -0
  124. data/spec/fixtures/data/2.1.0/weights.bin +0 -0
  125. data/spec/fixtures/data_generator.0.9.8.php +0 -208
  126. data/spec/fixtures/data_generator.0.9.9.php +0 -5
  127. data/spec/fixtures/data_generator.1.10.php +0 -5
  128. data/spec/fixtures/data_generator.2.0.1.php +0 -5
  129. data/spec/fixtures/data_generator.2.1.0.php +0 -5
  130. data/spec/fixtures/data_generator.php +0 -223
  131. data/spec/fixtures/sphinxapi.0.9.8.php +0 -1228
  132. data/spec/fixtures/sphinxapi.0.9.9.php +0 -1646
  133. data/spec/fixtures/sphinxapi.1.10.php +0 -1728
  134. data/spec/fixtures/sphinxapi.2.0.1.php +0 -1731
  135. data/spec/fixtures/sphinxapi.2.1.0.php +0 -1752
  136. data/spec/fixtures/sql/conf.example.yml +0 -3
  137. data/spec/fixtures/sql/data.sql +0 -25000
  138. data/spec/fixtures/sql/data.tsv +0 -25000
  139. data/spec/fixtures/sql/structure.sql +0 -16
  140. data/spec/functional/connection_spec.rb +0 -64
  141. data/spec/functional/escaping_spec.rb +0 -49
  142. data/spec/functional/excerpt_spec.rb +0 -139
  143. data/spec/functional/keywords_spec.rb +0 -40
  144. data/spec/functional/persistance_spec.rb +0 -17
  145. data/spec/functional/search_spec.rb +0 -67
  146. data/spec/functional/status_spec.rb +0 -21
  147. data/spec/functional/update_spec.rb +0 -41
  148. data/spec/riddle/auto_version_spec.rb +0 -95
  149. data/spec/riddle/client_spec.rb +0 -11
  150. data/spec/riddle/configuration_spec.rb +0 -28
  151. data/spec/riddle/controller_spec.rb +0 -39
  152. data/spec/riddle/query/delete_spec.rb +0 -18
  153. data/spec/riddle/query/insert_spec.rb +0 -25
  154. data/spec/riddle/query/select_spec.rb +0 -226
  155. data/spec/riddle/query_spec.rb +0 -97
  156. data/spec/riddle_spec.rb +0 -27
  157. data/spec/spec_helper.rb +0 -34
  158. data/spec/support/binary_fixtures.rb +0 -18
  159. data/spec/support/sphinx.rb +0 -137
  160. data/spec/unit/client_spec.rb +0 -290
  161. data/spec/unit/configuration/common_spec.rb +0 -60
  162. data/spec/unit/configuration/distributed_index_spec.rb +0 -58
  163. data/spec/unit/configuration/index_spec.rb +0 -124
  164. data/spec/unit/configuration/indexer_spec.rb +0 -73
  165. data/spec/unit/configuration/realtime_index_spec.rb +0 -65
  166. data/spec/unit/configuration/searchd_spec.rb +0 -228
  167. data/spec/unit/configuration/source_spec.rb +0 -5
  168. data/spec/unit/configuration/sql_source_spec.rb +0 -137
  169. data/spec/unit/configuration/template_index_spec.rb +0 -91
  170. data/spec/unit/configuration/tsv_source_spec.rb +0 -53
  171. data/spec/unit/configuration/xml_source_spec.rb +0 -51
  172. data/spec/unit/configuration_spec.rb +0 -25
  173. data/spec/unit/filter_spec.rb +0 -38
  174. data/spec/unit/message_spec.rb +0 -94
  175. data/spec/unit/response_spec.rb +0 -64
  176. data/spec/unit/riddle_spec.rb +0 -17
@@ -1,5 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Riddle::Configuration::Source do
4
- #
5
- end
@@ -1,137 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Riddle::Configuration::SQLSource do
4
- it "should be invalid without a host, user, database, and query if there's no parent" do
5
- source = Riddle::Configuration::SQLSource.new("src1", "mysql")
6
- source.should_not be_valid
7
-
8
- source.sql_host = "localhost"
9
- source.sql_user = "test"
10
- source.sql_db = "test"
11
- source.sql_query = "SELECT * FROM tables"
12
- source.should be_valid
13
-
14
- [:name, :type, :sql_host, :sql_user, :sql_db, :sql_query].each do |setting|
15
- value = source.send(setting)
16
- source.send("#{setting}=".to_sym, nil)
17
- source.should_not be_nil
18
- source.send("#{setting}=".to_sym, value)
19
- end
20
- end
21
-
22
- it "should be invalid without only a name and type if there is a parent" do
23
- source = Riddle::Configuration::SQLSource.new("src1", "mysql")
24
- source.should_not be_valid
25
-
26
- source.parent = "sqlparent"
27
- source.should be_valid
28
-
29
- source.name = nil
30
- source.should_not be_valid
31
-
32
- source.name = "src1"
33
- source.type = nil
34
- source.should_not be_valid
35
- end
36
-
37
- it "should raise a ConfigurationError if rendering when not valid" do
38
- source = Riddle::Configuration::SQLSource.new("src1", "mysql")
39
- lambda { source.render }.should raise_error(Riddle::Configuration::ConfigurationError)
40
- end
41
-
42
- it "should render correctly when valid" do
43
- source = Riddle::Configuration::SQLSource.new("src1", "mysql")
44
- source.sql_host = "localhost"
45
- source.sql_user = "test"
46
- source.sql_pass = ""
47
- source.sql_db = "test"
48
- source.sql_port = 3306
49
- source.sql_sock = "/tmp/mysql.sock"
50
- source.mysql_connect_flags = 32
51
- source.sql_query_pre << "SET NAMES utf8" << "SET SESSION query_cache_type=OFF"
52
- source.sql_query = "SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content FROM documents WHERE id >= $start AND id <= $end"
53
- source.sql_query_range = "SELECT MIN(id), MAX(id) FROM documents"
54
- source.sql_range_step = 1000
55
- source.sql_query_killlist = "SELECT id FROM documents WHERE edited>=@last_reindex"
56
- source.sql_attr_uint << "author_id" << "forum_id:9" << "group_id"
57
- source.sql_attr_bool << "is_deleted"
58
- source.sql_attr_bigint << "my_bigint_id"
59
- source.sql_attr_timestamp << "posted_ts" << "last_edited_ts" << "date_added"
60
- source.sql_attr_str2ordinal << "author_name"
61
- source.sql_attr_float << "lat_radians" << "long_radians"
62
- source.sql_attr_multi << "uint tag from query; select id, tag FROM tags"
63
- source.sql_query_post = ""
64
- source.sql_query_post_index = "REPLACE INTO counters (id, val) VALUES ('max_indexed_id', $maxid)"
65
- source.sql_ranged_throttle = 0
66
- source.sql_query_info = "SELECT * FROM documents WHERE id = $id"
67
- source.mssql_winauth = 1
68
- source.mssql_unicode = 1
69
- source.unpack_zlib << "zlib_column"
70
- source.unpack_mysqlcompress << "compressed_column" << "compressed_column_2"
71
- source.unpack_mysqlcompress_maxsize = "16M"
72
-
73
- source.render.should == <<-SQLSOURCE
74
- source src1
75
- {
76
- type = mysql
77
- sql_host = localhost
78
- sql_user = test
79
- sql_pass =
80
- sql_db = test
81
- sql_port = 3306
82
- sql_sock = /tmp/mysql.sock
83
- mysql_connect_flags = 32
84
- sql_query_pre = SET NAMES utf8
85
- sql_query_pre = SET SESSION query_cache_type=OFF
86
- sql_query = SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content FROM documents WHERE id >= $start AND id <= $end
87
- sql_query_range = SELECT MIN(id), MAX(id) FROM documents
88
- sql_range_step = 1000
89
- sql_query_killlist = SELECT id FROM documents WHERE edited>=@last_reindex
90
- sql_attr_uint = author_id
91
- sql_attr_uint = forum_id:9
92
- sql_attr_uint = group_id
93
- sql_attr_bool = is_deleted
94
- sql_attr_bigint = my_bigint_id
95
- sql_attr_timestamp = posted_ts
96
- sql_attr_timestamp = last_edited_ts
97
- sql_attr_timestamp = date_added
98
- sql_attr_str2ordinal = author_name
99
- sql_attr_float = lat_radians
100
- sql_attr_float = long_radians
101
- sql_attr_multi = uint tag from query; select id, tag FROM tags
102
- sql_query_post =
103
- sql_query_post_index = REPLACE INTO counters (id, val) VALUES ('max_indexed_id', $maxid)
104
- sql_ranged_throttle = 0
105
- sql_query_info = SELECT * FROM documents WHERE id = $id
106
- mssql_winauth = 1
107
- mssql_unicode = 1
108
- unpack_zlib = zlib_column
109
- unpack_mysqlcompress = compressed_column
110
- unpack_mysqlcompress = compressed_column_2
111
- unpack_mysqlcompress_maxsize = 16M
112
- }
113
- SQLSOURCE
114
- end
115
-
116
- it "should insert a backslash-newline into an sql_query when greater than 8178 characters" do
117
- source = Riddle::Configuration::SQLSource.new("src1", "mysql")
118
- source.sql_query = big_query_string[0, 8200]
119
- source.parent = 'src0'
120
-
121
- source.render.should match(/sql_query\s=\s[^\n]+\\\n/)
122
- end
123
-
124
- it "should insert two backslash-newlines into an sql_query when greater than 16,356 characters" do
125
- source = Riddle::Configuration::SQLSource.new("src1", "mysql")
126
- source.sql_query = big_query_string
127
- source.parent = 'src0'
128
-
129
- source.render.should match(/sql_query\s=\s[^\n]+\\\n[^\n]+\\\n/)
130
- end
131
-
132
- def big_query_string
133
- return <<-SQL
134
- SELECT MARLEY was dead to begin with There is no doubtwhatever about that The register of his burial wassigned by the clergyman the clerk the undertakerand the chief mourner Scrooge signed it andScrooges name was good upon Change for anything hechose to put his hand to Old Marley was as dead as adoornailMind I dont mean to say that I know of myown knowledge what there is particularly dead abouta doornail I might have been inclined myself toregard a coffinnail as the deadest piece of ironmongeryin the trade But the wisdom of our ancestorsis in the simile and my unhallowed handsshall not disturb it or the Countrys done for Youwill therefore permit me to repeat emphatically thatMarley was as dead as a doornailScrooge knew he was dead Of course he didHow could it be otherwise Scrooge and he werepartners for I dont know how many years Scroogewas his sole executor his sole administrator his soleassign his sole residuary legatee his sole friend andsole mourner And even Scrooge was not so dreadfullycut up by the sad event but that he was an excellentman of business on the very day of the funeraland solemnised it with an undoubted bargainThe mention of Marleys funeral brings me back tothe point I started from There is no doubt that Marleywas dead This must be distinctly understood ornothing wonderful can come of the story I am goingto relate If we were not perfectly convinced thatHamlets Father died before the play began therewould be nothing more remarkable in his taking astroll at night in an easterly wind upon his own rampartsthan there would be in any other middleagedgentleman rashly turning out after dark in a breezyspotsay Saint Pauls Churchyard for instanceliterally to astonish his sons weak mindScrooge never painted out Old Marleys nameThere it stood years afterwards above the warehousedoor Scrooge and Marley The firm was known asScrooge and Marley Sometimes people new to thebusiness called Scrooge Scrooge and sometimes Marleybut he answered to both names It was all thesame to himOh But he was a tightfisted hand at the grindstoneScrooge a squeezing wrenching grasping scrapingclutching covetous old sinner Hard and sharp as flintfrom which no steel had ever struck out generous firesecret and selfcontained and solitary as an oyster Thecold within him froze his old features nipped his pointednose shrivelled his cheek stiffened his gait made hiseyes red his thin lips blue and spoke out shrewdly in hisgrating voice A frosty rime was on his head and on hiseyebrows and his wiry chin He carried his own lowtemperature always about with him he iced his office inthe dogdays and didnt thaw it one degree at ChristmasExternal heat and cold had little influence onScrooge No warmth could warm no wintry weatherchill him No wind that blew was bitterer than heno falling snow was more intent upon its purpose nopelting rain less open to entreaty Foul weather didntknow where to have him The heaviest rain andsnow and hail and sleet could boast of the advantageover him in only one respect They often came downhandsomely and Scrooge never didNobody ever stopped him in the street to say withgladsome looks My dear Scrooge how are youWhen will you come to see me No beggars imploredhim to bestow a trifle no children asked himwhat it was oclock no man or woman ever once in allhis life inquired the way to such and such a place ofScrooge Even the blind mens dogs appeared toknow him and when they saw him coming on wouldtug their owners into doorways and up courts andthen would wag their tails as though they said Noeye at all is better than an evil eye dark masterBut what did Scrooge care It was the very thinghe liked To edge his way along the crowded pathsof life warning all human sympathy to keep its distancewas what the knowing ones call nuts to ScroogeOnce upon a timeof all the good days in the yearon Christmas Eveold Scrooge sat busy in hiscountinghouse It was cold bleak biting weather foggywithal and he could hear the people in the court outsidego wheezing up and down beating their handsupon their breasts and stamping their feet upon thepavement stones to warm them The city clocks hadonly just gone three but it was quite dark alreadyit had not been light all dayand candles were flaringin the windows of the neighbouring offices likeruddy smears upon the palpable brown air The fogcame pouring in at every chink and keyhole and wasso dense without that although the court was of thenarrowest the houses opposite were mere phantomsTo see the dingy cloud come drooping down obscuringeverything one might have thought that Naturelived hard by and was brewing on a large scaleThe door of Scrooges countinghouse was openthat he might keep his eye upon his clerk who in adismal little cell beyond a sort of tank was copyingletters Scrooge had a very small fire but the clerksfire was so very much smaller that it looked like onecoal But he couldnt replenish it for Scrooge keptthe coalbox in his own room and so surely as theclerk came in with the shovel the master predictedthat it would be necessary for them to part Whereforethe clerk put on his white comforter and tried towarm himself at the candle in which effort not beinga man of a strong imagination he failedA merry Christmas uncle God save you crieda cheerful voice It was the voice of Scroogesnephew who came upon him so quickly that this wasthe first intimation he had of his approachBah said Scrooge HumbugHe had so heated himself with rapid walking in thefog and frost this nephew of Scrooges that he wasall in a glow his face was ruddy and handsome hiseyes sparkled and his breath smoked againChristmas a humbug uncle said Scroogesnephew You dont mean that I am sureI do said Scrooge Merry Christmas Whatright have you to be merry What reason have youto be merry Youre poor enoughCome then returned the nephew gaily Whatright have you to be dismal What reason have youto be morose Youre rich enoughScrooge having no better answer ready on the spurof the moment said Bah again and followed it upwith HumbugDont be cross uncle said the nephewWhat else can I be returned the uncle when Ilive in such a world of fools as this Merry ChristmasOut upon merry Christmas Whats Christmastime to you but a time for paying bills withoutmoney a time for finding yourself a year older butnot an hour richer a time for balancing your booksand having every item in em through a round dozenof months presented dead against you If I couldwork my will said Scrooge indignantly every idiotwho goes about with Merry Christmas on his lipsshould be boiled with his own pudding and buriedwith a stake of holly through his heart He shouldUncle pleaded the nephewNephew returned the uncle sternly keep Christmasin your own way and let me keep it in mineKeep it repeated Scrooges nephew But youdont keep itLet me leave it alone then said Scrooge Muchgood may it do you Much good it has ever doneyouThere are many things from which I might havederived good by which I have not profited I daresay returned the nephew Christmas among therest But I am sure I have always thought of Christmastime when it has come roundapart from theveneration due to its sacred name and origin if anythingbelonging to it can be apart from thatas agood time a kind forgiving charitable pleasanttime the only time I know of in the long calendarof the year when men and women seem by one consentto open their shutup hearts freely and to thinkof people below them as if they really werefellowpassengers to the grave and not another raceof creatures bound on other journeys And thereforeuncle though it has never put a scrap of gold orsilver in my pocket I believe that it has done megood and will do me good and I say God bless itThe clerk in the Tank involuntarily applaudedBecoming immediately sensible of the improprietyhe poked the fire and extinguished the last frail sparkfor everLet me hear another sound from you saidScrooge and youll keep your Christmas by losingyour situation Youre quite a powerful speakersir he added turning to his nephew I wonder youdont go into ParliamentDont be angry uncle Come Dine with us tomorrowScrooge said that he would see himyes indeed hedid He went the whole length of the expressionand said that he would see him in that extremity firstBut why cried Scrooges nephew WhyWhy did you get married said ScroogeBecause I fell in loveBecause you fell in love growled Scrooge as ifthat were the only one thing in the world more ridiculousthan a merry Christmas Good afternoonNay uncle but you never came to see me beforethat happened Why give it as a reason for notcoming nowGood afternoon said ScroogeI want nothing from you I ask nothing of youwhy cannot we be friendsGood afternoon said ScroogeI am sorry with all my heart to find you soresolute We have never had any quarrel to which Ihave been a party But I have made the trial inhomage to Christmas and Ill keep my Christmashumour to the last So A Merry Christmas uncleGood afternoon said ScroogeAnd A Happy New YearGood afternoon said ScroogeHis nephew left the room without an angry wordnotwithstanding He stopped at the outer door tobestow the greetings of the season on the clerk whocold as he was was warmer than Scrooge for he returnedthem cordiallyTheres another fellow muttered Scrooge whooverheard him my clerk with fifteen shillings aweek and a wife and family talking about a merryChristmas Ill retire to BedlamThis lunatic in letting Scrooges nephew out hadlet two other people in They were portly gentlemenpleasant to behold and now stood with their hats offin Scrooges office They had books and papers intheir hands and bowed to himScrooge and Marleys I believe said one of thegentlemen referring to his list Have I the pleasureof addressing Mr Scrooge or Mr MarleyMr Marley has been dead these seven yearsScrooge replied He died seven years ago this verynightWe have no doubt his liberality is well representedby his surviving partner said the gentleman presentinghis credentialsIt certainly was for they had been two kindredspirits At the ominous word liberality Scroogefrowned and shook his head and handed the credentialsbackAt this festive season of the year Mr Scroogesaid the gentleman taking up a pen it is more thanusually desirable that we should make some slightprovision for the Poor and destitute who suffergreatly at the present time Many thousands are inwant of common necessaries hundreds of thousandsare in want of common comforts sirAre there no prisons asked ScroogePlenty of prisons said the gentleman laying downthe pen againAnd the Union workhouses demanded ScroogeAre they still in operationThey are Still returned the gentleman I wishI could say they were notThe Treadmill and the Poor Law are in full vigourthen said ScroogeBoth very busy sirOh I was afraid from what you said at firstthat something had occurred to stop them in theiruseful course said Scrooge Im very glad tohear itUnder the impression that they scarcely furnishChristian cheer of mind or body to the multitudereturned the gentleman a few of us are endeavouringto raise a fund to buy the Poor some meat and drinkand means of warmth We choose this time becauseit is a time of all others when Want is keenly feltand Abundance rejoices What shall I put you downforNothing Scrooge repliedYou wish to be anonymousI wish to be left alone said Scrooge Since youask me what I wish gentlemen that is my answerI dont make merry myself at Christmas and I cantafford to make idle people merry I help to supportthe establishments I have mentionedthey costenough and those who are badly off must go thereMany cant go there and many would rather dieIf they would rather die said Scrooge they hadbetter do it and decrease the surplus populationBesidesexcuse meI dont know thatBut you might know it observed the gentlemanIts not my business Scrooge returned Itsenough for a man to understand his own business andnot to interfere with other peoples Mine occupiesme constantly Good afternoon gentlemenSeeing clearly that it would be useless to pursuetheir point the gentlemen withdrew Scrooge resumedhis labours with an improved opinion of himselfand in a more facetious temper than was usualwith himMeanwhile the fog and darkness thickened so thatpeople ran about with flaring links proffering theirservices to go before horses in carriages and conductthem on their way The ancient tower of a churchwhose gruff old bell was always peeping slily downat Scrooge out of a Gothic window in the wall becameinvisible and struck the hours and quarters in theclouds with tremulous vibrations afterwards as ifits teeth were chattering in its frozen head up thereThe cold became intense In the main street at thecorner of the court some labourers were repairingthe gaspipes and had lighted a great fire in a brazierround which a party of ragged men and boys weregathered warming their hands and winking theireyes before the blaze in rapture The waterplugbeing left in solitude its overflowings sullenly congealedand turned to misanthropic ice The brightnessof the shops where holly sprigs and berriescrackled in the lamp heat of the windows made palefaces ruddy as they passed Poulterers and grocerstrades became a splendid joke a glorious pageantwith which it was next to impossible to believe thatsuch dull principles as bargain and sale had anythingto do The Lord Mayor in the stronghold of themighty Mansion House gave orders to his fifty cooksand butlers to keep Christmas as a Lord Mayorshousehold should and even the little tailor whom hehad fined five shillings on the previous Monday forbeing drunk and bloodthirsty in the streets stirred uptomorrows pudding in his garret while his leanwife and the baby sallied out to buy the beefFoggier yet and colder Piercing searching bitingcold If the good Saint Dunstan had but nippedthe Evil Spirits nose with a touch of such weatheras that instead of using his familiar weapons thenindeed he would have roared to lusty purpose Theowner of one scant young nose gnawed and mumbledby the hungry cold as bones are gnawed by dogsstooped down at Scrooges keyhole to regale him witha Christmas carol but at the first sound of God bless you merry gentleman May nothing you dismayScrooge seized the ruler with such energy of actionthat the singer fled in terror leaving the keyhole tothe fog and even more congenial frostAt length the hour of shutting up the countinghousearrived With an illwill Scrooge dismounted from hisstool and tacitly admitted the fact to the expectantclerk in the Tank who instantly snuffed his candle outand put on his hatYoull want all day tomorrow I suppose saidScroogeIf quite convenient sirIts not convenient said Scrooge and its notfair If I was to stop halfacrown for it youdthink yourself illused Ill be boundThe clerk smiled faintlyAnd yet said Scrooge you dont think me illusedwhen I pay a days wages for no workThe clerk observed that it was only once a yearA poor excuse for picking a mans pocket everytwentyfifth of December said Scrooge buttoninghis greatcoat to the chin But I suppose you musthave the whole day Be here all the earlier nextmorningThe clerk promised that he would and Scroogewalked out with a growl The office was closed in atwinkling and the clerk with the long ends of hiswhite comforter dangling below his waist for heboasted no greatcoat went down a slide on Cornhillat the end of a lane of boys twenty times inhonour of its being Christmas Eve and then ran hometo Camden Town as hard as he could pelt to playat blindmansbuffScrooge took his melancholy dinner in his usualmelancholy tavern and having read all the newspapers andbeguiled the rest of the evening with hisbankersbook went home to bed He lived inchambers which had once belonged to his deceasedpartner They were a gloomy suite of rooms in alowering pile of building up a yard where it had solittle business to be that one could scarcely helpfancying it must have run there when it was a younghouse playing at hideandseek with other housesand forgotten the way out again It was old enoughnow and dreary enough for nobody lived in it butScrooge the other rooms being all let out as officesThe yard was so dark that even Scrooge who knewits every stone was fain to grope with his handsThe fog and frost so hung about the black old gatewayof the house that it seemed as if the Genius ofthe Weather sat in mournful meditation on thethresholdNow it is a fact that there was nothing at allparticular about the knocker on the door except that itwas very large It is also a fact that Scrooge hadseen it night and morning during his whole residencein that place also that Scrooge had as little of whatis called fancy about him as any man in the city ofLondon even includingwhich is a bold wordthecorporation aldermen and livery Let it also beborne in mind that Scrooge had not bestowed onethought on Marley since his last mention of hisseven years dead partner that afternoon And thenlet any man explain to me if he can how it happenedthat Scrooge having his key in the lock of the doorsaw in the knocker without its undergoing any intermediateprocess of changenot a knocker but Marleys faceMarleys face It was not in impenetrable shadowas the other objects in the yard were but had adismal light about it like a bad lobster in a darkcellar It was not angry or ferocious but lookedat Scrooge as Marley used to look with ghostlyspectacles turned up on its ghostly forehead Thehair was curiously stirred as if by breath or hot airand though the eyes were wide open they were perfectlymotionless FROM documents
135
- SQL
136
- end
137
- end
@@ -1,91 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Riddle::Configuration::TemplateIndex do
4
- it "should be invalid without a name" do
5
- index = Riddle::Configuration::TemplateIndex.new(nil)
6
- index.should_not be_valid
7
-
8
- index.name = "test1"
9
- index.should be_valid
10
- end
11
-
12
- it "should raise a ConfigurationError if rendering when not valid" do
13
- index = Riddle::Configuration::TemplateIndex.new(nil)
14
- lambda {
15
- index.render
16
- }.should raise_error(Riddle::Configuration::ConfigurationError)
17
- end
18
-
19
- it "should render correctly if supplied settings are valid" do
20
- index = Riddle::Configuration::TemplateIndex.new("test1")
21
- index.docinfo = "extern"
22
- index.mlock = 0
23
- index.morphologies << "stem_en" << "stem_ru" << "soundex"
24
- index.min_stemming_len = 1
25
- index.stopword_files << "/var/data/stopwords.txt" << "/var/data/stopwords2.txt"
26
- index.wordform_files << "/var/data/wordforms.txt"
27
- index.exception_files << "/var/data/exceptions.txt"
28
- index.min_word_len = 1
29
- index.charset_type = "utf-8"
30
- index.charset_table = "0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F"
31
- index.ignore_characters << "U+00AD"
32
- index.min_prefix_len = 0
33
- index.min_infix_len = 0
34
- index.prefix_field_names << "filename"
35
- index.infix_field_names << "url" << "domain"
36
- index.enable_star = true
37
- index.ngram_len = 1
38
- index.ngram_characters << "U+3000..U+2FA1F"
39
- index.phrase_boundaries << "." << "?" << "!" << "U+2026"
40
- index.phrase_boundary_step = 100
41
- index.html_strip = 0
42
- index.html_index_attrs = "img=alt,title; a=title"
43
- index.html_remove_element_tags << "style" << "script"
44
- index.preopen = 1
45
- index.ondisk_dict = 1
46
- index.inplace_enable = 1
47
- index.inplace_hit_gap = 0
48
- index.inplace_docinfo_gap = 0
49
- index.inplace_reloc_factor = 0.1
50
- index.inplace_write_factor = 0.1
51
- index.index_exact_words = 1
52
-
53
- index.render.should == <<-INDEX
54
- index test1
55
- {
56
- type = template
57
- docinfo = extern
58
- mlock = 0
59
- morphology = stem_en, stem_ru, soundex
60
- min_stemming_len = 1
61
- stopwords = /var/data/stopwords.txt /var/data/stopwords2.txt
62
- wordforms = /var/data/wordforms.txt
63
- exceptions = /var/data/exceptions.txt
64
- min_word_len = 1
65
- charset_type = utf-8
66
- charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
67
- ignore_chars = U+00AD
68
- min_prefix_len = 0
69
- min_infix_len = 0
70
- prefix_fields = filename
71
- infix_fields = url, domain
72
- enable_star = 1
73
- ngram_len = 1
74
- ngram_chars = U+3000..U+2FA1F
75
- phrase_boundary = ., ?, !, U+2026
76
- phrase_boundary_step = 100
77
- html_strip = 0
78
- html_index_attrs = img=alt,title; a=title
79
- html_remove_elements = style, script
80
- preopen = 1
81
- ondisk_dict = 1
82
- inplace_enable = 1
83
- inplace_hit_gap = 0
84
- inplace_docinfo_gap = 0
85
- inplace_reloc_factor = 0.1
86
- inplace_write_factor = 0.1
87
- index_exact_words = 1
88
- }
89
- INDEX
90
- end
91
- end
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Riddle::Configuration::TSVSource do
4
- it "should be invalid without an tsvpipe command, name and type if there's no parent" do
5
- source = Riddle::Configuration::TSVSource.new("tsv1")
6
- source.should_not be_valid
7
-
8
- source.tsvpipe_command = "ls /var/null"
9
- source.should be_valid
10
-
11
- source.name = nil
12
- source.should_not be_valid
13
-
14
- source.name = "tsv1"
15
- source.type = nil
16
- source.should_not be_valid
17
- end
18
-
19
- it "should be invalid without only a name and type if there is a parent" do
20
- source = Riddle::Configuration::TSVSource.new("tsv1")
21
- source.should_not be_valid
22
-
23
- source.parent = "tsvparent"
24
- source.should be_valid
25
-
26
- source.name = nil
27
- source.should_not be_valid
28
-
29
- source.name = "tsv1"
30
- source.type = nil
31
- source.should_not be_valid
32
- end
33
-
34
- it "should raise a ConfigurationError if rendering when not valid" do
35
- source = Riddle::Configuration::TSVSource.new("tsv1")
36
- lambda {
37
- source.render
38
- }.should raise_error(Riddle::Configuration::ConfigurationError)
39
- end
40
-
41
- it "should render correctly when valid" do
42
- source = Riddle::Configuration::TSVSource.new("tsv1")
43
- source.tsvpipe_command = "ls /var/null"
44
-
45
- source.render.should == <<-TSVSOURCE
46
- source tsv1
47
- {
48
- type = tsvpipe
49
- tsvpipe_command = ls /var/null
50
- }
51
- TSVSOURCE
52
- end
53
- end
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Riddle::Configuration::XMLSource do
4
- it "should be invalid without an xmlpipe command, name and type if there's no parent" do
5
- source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
6
- source.should_not be_valid
7
-
8
- source.xmlpipe_command = "ls /var/null"
9
- source.should be_valid
10
-
11
- source.name = nil
12
- source.should_not be_valid
13
-
14
- source.name = "xml1"
15
- source.type = nil
16
- source.should_not be_valid
17
- end
18
-
19
- it "should be invalid without only a name and type if there is a parent" do
20
- source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
21
- source.should_not be_valid
22
-
23
- source.parent = "xmlparent"
24
- source.should be_valid
25
-
26
- source.name = nil
27
- source.should_not be_valid
28
-
29
- source.name = "xml1"
30
- source.type = nil
31
- source.should_not be_valid
32
- end
33
-
34
- it "should raise a ConfigurationError if rendering when not valid" do
35
- source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
36
- lambda { source.render }.should raise_error(Riddle::Configuration::ConfigurationError)
37
- end
38
-
39
- it "should render correctly when valid" do
40
- source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
41
- source.xmlpipe_command = "ls /var/null"
42
-
43
- source.render.should == <<-XMLSOURCE
44
- source xml1
45
- {
46
- type = xmlpipe
47
- xmlpipe_command = ls /var/null
48
- }
49
- XMLSOURCE
50
- end
51
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Riddle::Configuration do
4
- it "should render all given indexes and sources, plus the indexer and search sections" do
5
- config = Riddle::Configuration.new
6
-
7
- config.searchd.port = 3312
8
- config.searchd.pid_file = "file.pid"
9
-
10
- source = Riddle::Configuration::XMLSource.new("src1", "xmlpipe")
11
- source.xmlpipe_command = "ls /dev/null"
12
-
13
- index = Riddle::Configuration::Index.new("index1")
14
- index.path = "/path/to/index1"
15
- index.sources << source
16
-
17
- config.indices << index
18
- generated_conf = config.render
19
-
20
- generated_conf.should match(/index index1/)
21
- generated_conf.should match(/source src1/)
22
- generated_conf.should match(/indexer/)
23
- generated_conf.should match(/searchd/)
24
- end
25
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Riddle::Client::Filter do
4
- it "should render a filter that uses an array of ints correctly" do
5
- filter = Riddle::Client::Filter.new("field", [1, 2, 3])
6
- filter.query_message.should == query_contents(:filter_array)
7
- end
8
-
9
- it "should render a filter that has exclude set correctly" do
10
- filter = Riddle::Client::Filter.new("field", [1, 2, 3], true)
11
- filter.query_message.should == query_contents(:filter_array_exclude)
12
- end
13
-
14
- it "should render a filter that is a range of ints correctly" do
15
- filter = Riddle::Client::Filter.new("field", 1..3)
16
- filter.query_message.should == query_contents(:filter_range)
17
- end
18
-
19
- it "should render a filter that is a range of ints as exclude correctly" do
20
- filter = Riddle::Client::Filter.new("field", 1..3, true)
21
- filter.query_message.should == query_contents(:filter_range_exclude)
22
- end
23
-
24
- it "should render a filter that is a range of floats correctly" do
25
- filter = Riddle::Client::Filter.new("field", 5.4..13.5)
26
- filter.query_message.should == query_contents(:filter_floats)
27
- end
28
-
29
- it "should render a filter that is a range of floats as exclude correctly" do
30
- filter = Riddle::Client::Filter.new("field", 5.4..13.5, true)
31
- filter.query_message.should == query_contents(:filter_floats_exclude)
32
- end
33
-
34
- it "should render a filter that is an array of boolean values correctly" do
35
- filter = Riddle::Client::Filter.new("field", [false, true])
36
- filter.query_message.should == query_contents(:filter_boolean)
37
- end
38
- end
@@ -1,94 +0,0 @@
1
- # encoding: BINARY
2
- require 'spec_helper'
3
-
4
- describe Riddle::Client::Message do
5
- it "should start with an empty string" do
6
- Riddle::Client::Message.new.to_s.should == ""
7
- end
8
-
9
- it "should append raw data correctly" do
10
- data = [1, 2, 3].pack('NNN')
11
- message = Riddle::Client::Message.new
12
- message.append data
13
- message.to_s.should == data
14
- end
15
-
16
- it "should append strings correctly - with length first" do
17
- str = "something to test with"
18
- message = Riddle::Client::Message.new
19
- message.append_string str
20
- message.to_s.should == [str.length].pack('N') + str
21
- end
22
-
23
- it "should append integers correctly - packed with N" do
24
- message = Riddle::Client::Message.new
25
- message.append_int 234
26
- message.to_s.should == "\x00\x00\x00\xEA"
27
- end
28
-
29
- it "should append integers as strings correctly - packed with N" do
30
- message = Riddle::Client::Message.new
31
- message.append_int "234"
32
- message.to_s.should == "\x00\x00\x00\xEA"
33
- end
34
-
35
- it "should append 64bit integers correctly" do
36
- message = Riddle::Client::Message.new
37
- message.append_64bit_int 234
38
- message.to_s.should == "\x00\x00\x00\x00\x00\x00\x00\xEA"
39
- end
40
-
41
- it "should append 64bit integers that use exactly 32bits correctly" do
42
- message = Riddle::Client::Message.new
43
- message.append_64bit_int 4294967295
44
- message.to_s.should == "\x00\x00\x00\x00\xFF\xFF\xFF\xFF"
45
- end
46
-
47
- it "should append 64bit integers that use more than 32 bits correctly" do
48
- message = Riddle::Client::Message.new
49
- message.append_64bit_int 4294967296
50
- message.to_s.should == "\x00\x00\x00\x01\x00\x00\x00\x00"
51
- end
52
-
53
- it "should append 64bit integers as strings correctly" do
54
- message = Riddle::Client::Message.new
55
- message.append_64bit_int "234"
56
- message.to_s.should == "\x00\x00\x00\x00\x00\x00\x00\xEA"
57
- end
58
-
59
- it "should append floats correctly - packed with f" do
60
- message = Riddle::Client::Message.new
61
- message.append_float 1.4
62
- message.to_s.should == [1.4].pack('f').unpack('L*').pack('N')
63
- end
64
-
65
- it "should append a collection of integers correctly" do
66
- message = Riddle::Client::Message.new
67
- message.append_ints 1, 2, 3, 4
68
- message.to_s.should == [1, 2, 3, 4].pack('NNNN')
69
- end
70
-
71
- it "should append a collection of floats correctly" do
72
- message = Riddle::Client::Message.new
73
- message.append_floats 1.0, 1.1, 1.2, 1.3
74
- message.to_s.should == [1.0, 1.1, 1.2, 1.3].pack('ffff').unpack('L*L*L*L*').pack('NNNN')
75
- end
76
-
77
- it "should append an array of strings correctly" do
78
- arr = ["a", "bb", "ccc"]
79
- message = Riddle::Client::Message.new
80
- message.append_array arr
81
- message.to_s.should == [3, 1].pack('NN') + "a" + [2].pack('N') + "bb" +
82
- [3].pack('N') + "ccc"
83
- end
84
-
85
- it "should append a variety of objects correctly" do
86
- message = Riddle::Client::Message.new
87
- message.append_int 4
88
- message.append_string "test"
89
- message.append_array ["one", "two"]
90
- message.append_floats 1.5, 1.7
91
- message.to_s.should == [4, 4].pack('NN') + "test" + [2, 3].pack('NN') +
92
- "one" + [3].pack('N') + "two" + [1.5, 1.7].pack('ff').unpack('L*L*').pack('NN')
93
- end
94
- end