riddle 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/README.textile +1 -0
  2. data/lib/riddle.rb +30 -4
  3. data/lib/riddle/0.9.8.rb +1 -0
  4. data/lib/riddle/0.9.9.rb +2 -0
  5. data/lib/riddle/auto_version.rb +11 -0
  6. data/lib/riddle/client.rb +2 -0
  7. data/lib/riddle/configuration.rb +3 -1
  8. data/lib/riddle/configuration/sql_source.rb +13 -0
  9. data/lib/riddle/controller.rb +29 -2
  10. data/spec/functional/excerpt_spec.rb +2 -2
  11. data/spec/functional/status_spec.rb +1 -1
  12. data/spec/riddle/auto_version_spec.rb +24 -0
  13. data/spec/riddle/client_spec.rb +11 -0
  14. data/spec/riddle/configuration_spec.rb +11 -0
  15. data/spec/riddle/controller_spec.rb +29 -0
  16. data/spec/riddle_spec.rb +27 -0
  17. data/spec/spec_helper.rb +1 -4
  18. data/spec/unit/client_spec.rb +1 -1
  19. data/spec/unit/configuration/searchd_spec.rb +2 -2
  20. data/spec/unit/configuration/sql_source_spec.rb +21 -0
  21. metadata +8 -48
  22. data/spec/fixtures/data/anchor.bin +0 -0
  23. data/spec/fixtures/data/any.bin +0 -0
  24. data/spec/fixtures/data/boolean.bin +0 -0
  25. data/spec/fixtures/data/comment.bin +0 -0
  26. data/spec/fixtures/data/distinct.bin +0 -0
  27. data/spec/fixtures/data/field_weights.bin +0 -0
  28. data/spec/fixtures/data/filter.bin +0 -0
  29. data/spec/fixtures/data/filter_array.bin +0 -0
  30. data/spec/fixtures/data/filter_array_exclude.bin +0 -0
  31. data/spec/fixtures/data/filter_boolean.bin +0 -0
  32. data/spec/fixtures/data/filter_floats.bin +0 -0
  33. data/spec/fixtures/data/filter_floats_exclude.bin +0 -0
  34. data/spec/fixtures/data/filter_range.bin +0 -0
  35. data/spec/fixtures/data/filter_range_exclude.bin +0 -0
  36. data/spec/fixtures/data/group.bin +0 -0
  37. data/spec/fixtures/data/index.bin +0 -0
  38. data/spec/fixtures/data/index_weights.bin +0 -0
  39. data/spec/fixtures/data/keywords_with_hits.bin +0 -0
  40. data/spec/fixtures/data/keywords_without_hits.bin +0 -0
  41. data/spec/fixtures/data/overrides.bin +0 -0
  42. data/spec/fixtures/data/phrase.bin +0 -0
  43. data/spec/fixtures/data/rank_mode.bin +0 -0
  44. data/spec/fixtures/data/select.bin +0 -0
  45. data/spec/fixtures/data/simple.bin +0 -0
  46. data/spec/fixtures/data/sort.bin +0 -0
  47. data/spec/fixtures/data/update_simple.bin +0 -0
  48. data/spec/fixtures/data/weights.bin +0 -0
  49. data/spec/fixtures/data_generator.0.9.8.php +0 -208
  50. data/spec/fixtures/data_generator.0.9.9.php +0 -225
  51. data/spec/fixtures/sphinx/configuration.erb +0 -38
  52. data/spec/fixtures/sphinx/people.spa +0 -0
  53. data/spec/fixtures/sphinx/people.spd +0 -0
  54. data/spec/fixtures/sphinx/people.sph +0 -0
  55. data/spec/fixtures/sphinx/people.spi +0 -0
  56. data/spec/fixtures/sphinx/people.spk +0 -0
  57. data/spec/fixtures/sphinx/people.spm +0 -0
  58. data/spec/fixtures/sphinx/people.spp +0 -0
  59. data/spec/fixtures/sphinx/searchd.log +0 -4430
  60. data/spec/fixtures/sphinx/searchd.query.log +0 -1234
  61. data/spec/fixtures/sphinx/spec.conf +0 -38
  62. data/spec/fixtures/sphinxapi.0.9.8.php +0 -1228
  63. data/spec/fixtures/sphinxapi.0.9.9.php +0 -1646
  64. data/spec/fixtures/sql/conf.example.yml +0 -3
  65. data/spec/fixtures/sql/conf.yml +0 -3
  66. data/spec/fixtures/sql/data.sql +0 -25000
  67. data/spec/fixtures/sql/structure.sql +0 -16
Binary file
Binary file
Binary file
Binary file
@@ -1,208 +0,0 @@
1
- <?php
2
- include 'sphinxapi.0.9.8.php';
3
-
4
- $client = new SphinxClient();
5
- $client->SetServer("localhost", 3312);
6
-
7
- // simple
8
- $file = fopen("spec/fixtures/data/simple.bin", "w");
9
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
10
- fclose($file);
11
-
12
- // index
13
- $file = fopen("spec/fixtures/data/index.bin", "w");
14
- fwrite($file, $client->_reqs[$client->AddQuery("test ", "edition")]);
15
- fclose($file);
16
-
17
- // any
18
- $client->SetMatchMode(SPH_MATCH_ANY);
19
-
20
- $file = fopen("spec/fixtures/data/any.bin", "w");
21
- fwrite($file, $client->_reqs[$client->AddQuery("test this ")]);
22
- fclose($file);
23
-
24
- $client->SetMatchMode(SPH_MATCH_ALL);
25
-
26
- // sort
27
- $client->SetSortMode(SPH_SORT_EXTENDED, "id");
28
-
29
- $file = fopen("spec/fixtures/data/sort.bin", "w");
30
- fwrite($file, $client->_reqs[$client->AddQuery("testing ")]);
31
- fclose($file);
32
-
33
- $client->SetSortMode(SPH_SORT_RELEVANCE, "");
34
-
35
- // boolean
36
- $client->SetMatchMode(SPH_MATCH_BOOLEAN);
37
-
38
- $file = fopen("spec/fixtures/data/boolean.bin", "w");
39
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
40
- fclose($file);
41
-
42
- $client->SetMatchMode(SPH_MATCH_ALL);
43
-
44
- // phrase
45
- $client->SetMatchMode(SPH_MATCH_PHRASE);
46
-
47
- $file = fopen("spec/fixtures/data/phrase.bin", "w");
48
- fwrite($file, $client->_reqs[$client->AddQuery("testing this ")]);
49
- fclose($file);
50
-
51
- $client->SetMatchMode(SPH_MATCH_ALL);
52
-
53
- // filter
54
- $client->SetFilter("id", array(10, 100, 1000));
55
-
56
- $file = fopen("spec/fixtures/data/filter.bin", "w");
57
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
58
- fclose($file);
59
-
60
- $client->ResetFilters();
61
-
62
- // group
63
- $client->SetGroupBy("id", SPH_GROUPBY_ATTR, "id");
64
-
65
- $file = fopen("spec/fixtures/data/group.bin", "w");
66
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
67
- fclose($file);
68
-
69
- $client->ResetGroupBy();
70
-
71
- // distinct
72
- $client->SetGroupDistinct("id");
73
-
74
- $file = fopen("spec/fixtures/data/distinct.bin", "w");
75
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
76
- fclose($file);
77
-
78
- $client->ResetGroupBy();
79
-
80
- // weights
81
- $client->SetWeights(array(100, 1));
82
-
83
- $file = fopen("spec/fixtures/data/weights.bin", "w");
84
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
85
- fclose($file);
86
-
87
- $client->SetWeights(array());
88
-
89
- // anchor
90
- $client->SetGeoAnchor("latitude", "longitude", 10.0, 95.0);
91
-
92
- $file = fopen("spec/fixtures/data/anchor.bin", "w");
93
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
94
- fclose($file);
95
-
96
- $client->ResetFilters();
97
-
98
- // rank_mode
99
- $client->SetRankingMode(SPH_RANK_WORDCOUNT);
100
-
101
- $file = fopen("spec/fixtures/data/rank_mode.bin", "w");
102
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
103
- fclose($file);
104
-
105
- $client->SetRankingMode(SPH_RANK_PROXIMITY_BM25);
106
-
107
- // index_weights
108
- $client->SetIndexWeights(array("people" => 101));
109
-
110
- $file = fopen("spec/fixtures/data/index_weights.bin", "w");
111
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
112
- fclose($file);
113
-
114
- $client->SetIndexWeights(array());
115
-
116
- // index_weights
117
- $client->SetFieldWeights(array("city" => 101));
118
-
119
- $file = fopen("spec/fixtures/data/field_weights.bin", "w");
120
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
121
- fclose($file);
122
-
123
- $client->SetFieldWeights(array());
124
-
125
- // comment
126
- $file = fopen("spec/fixtures/data/comment.bin", "w");
127
- fwrite($file, $client->_reqs[$client->AddQuery("test ", "*", "commenting")]);
128
- fclose($file);
129
-
130
- // update_simple
131
- $file = fopen("spec/fixtures/data/update_simple.bin", "w");
132
- fwrite($file, $client->UpdateAttributes("people", array("birthday"), array(1 => array(191163600))));
133
- fclose($file);
134
-
135
- // keywords_without_hits
136
- $file = fopen("spec/fixtures/data/keywords_without_hits.bin", "w");
137
- fwrite($file, $client->BuildKeywords("pat", "people", false));
138
- fclose($file);
139
-
140
- // keywords_with_hits
141
- $file = fopen("spec/fixtures/data/keywords_with_hits.bin", "w");
142
- fwrite($file, $client->BuildKeywords("pat", "people", true));
143
- fclose($file);
144
-
145
- // filter_array
146
- $client->SetFilter("field", array(1, 2, 3));
147
-
148
- $file = fopen("spec/fixtures/data/filter_array.bin", "w");
149
- fwrite($file, $client->FilterOutput());
150
- fclose($file);
151
-
152
- $client->ResetFilters();
153
-
154
- // filter_array_exclude
155
- $client->SetFilter("field", array(1, 2, 3), true);
156
-
157
- $file = fopen("spec/fixtures/data/filter_array_exclude.bin", "w");
158
- fwrite($file, $client->FilterOutput());
159
- fclose($file);
160
-
161
- $client->ResetFilters();
162
-
163
- // filter_range
164
- $client->SetFilterRange("field", 1, 3);
165
-
166
- $file = fopen("spec/fixtures/data/filter_range.bin", "w");
167
- fwrite($file, $client->FilterOutput());
168
- fclose($file);
169
-
170
- $client->ResetFilters();
171
-
172
- // filter_range_exclude
173
- $client->SetFilterRange("field", 1, 3, true);
174
-
175
- $file = fopen("spec/fixtures/data/filter_range_exclude.bin", "w");
176
- fwrite($file, $client->FilterOutput());
177
- fclose($file);
178
-
179
- $client->ResetFilters();
180
-
181
- // filter_floats
182
- $client->SetFilterFloatRange("field", 5.4, 13.5);
183
-
184
- $file = fopen("spec/fixtures/data/filter_floats.bin", "w");
185
- fwrite($file, $client->FilterOutput());
186
- fclose($file);
187
-
188
- $client->ResetFilters();
189
-
190
- // filter_floats_exclude
191
- $client->SetFilterFloatRange("field", 5.4, 13.5, true);
192
-
193
- $file = fopen("spec/fixtures/data/filter_floats_exclude.bin", "w");
194
- fwrite($file, $client->FilterOutput());
195
- fclose($file);
196
-
197
- $client->ResetFilters();
198
-
199
- // filter_boolean
200
- $client->SetFilter("field", array(0, 1));
201
-
202
- $file = fopen("spec/fixtures/data/filter_boolean.bin", "w");
203
- fwrite($file, $client->FilterOutput());
204
- fclose($file);
205
-
206
- $client->ResetFilters();
207
-
208
- ?>
@@ -1,225 +0,0 @@
1
- <?php
2
- include 'sphinxapi.0.9.9.php';
3
-
4
- $client = new SphinxClient();
5
- $client->SetServer("localhost", 3312);
6
-
7
- // simple
8
- $file = fopen("spec/fixtures/data/simple.bin", "w");
9
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
10
- fclose($file);
11
-
12
- // index
13
- $file = fopen("spec/fixtures/data/index.bin", "w");
14
- fwrite($file, $client->_reqs[$client->AddQuery("test ", "edition")]);
15
- fclose($file);
16
-
17
- // any
18
- $client->SetMatchMode(SPH_MATCH_ANY);
19
-
20
- $file = fopen("spec/fixtures/data/any.bin", "w");
21
- fwrite($file, $client->_reqs[$client->AddQuery("test this ")]);
22
- fclose($file);
23
-
24
- $client->SetMatchMode(SPH_MATCH_ALL);
25
-
26
- // sort
27
- $client->SetSortMode(SPH_SORT_EXTENDED, "id");
28
-
29
- $file = fopen("spec/fixtures/data/sort.bin", "w");
30
- fwrite($file, $client->_reqs[$client->AddQuery("testing ")]);
31
- fclose($file);
32
-
33
- $client->SetSortMode(SPH_SORT_RELEVANCE, "");
34
-
35
- // boolean
36
- $client->SetMatchMode(SPH_MATCH_BOOLEAN);
37
-
38
- $file = fopen("spec/fixtures/data/boolean.bin", "w");
39
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
40
- fclose($file);
41
-
42
- $client->SetMatchMode(SPH_MATCH_ALL);
43
-
44
- // phrase
45
- $client->SetMatchMode(SPH_MATCH_PHRASE);
46
-
47
- $file = fopen("spec/fixtures/data/phrase.bin", "w");
48
- fwrite($file, $client->_reqs[$client->AddQuery("testing this ")]);
49
- fclose($file);
50
-
51
- $client->SetMatchMode(SPH_MATCH_ALL);
52
-
53
- // filter
54
- $client->SetFilter("id", array(10, 100, 1000));
55
-
56
- $file = fopen("spec/fixtures/data/filter.bin", "w");
57
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
58
- fclose($file);
59
-
60
- $client->ResetFilters();
61
-
62
- // group
63
- $client->SetGroupBy("id", SPH_GROUPBY_ATTR, "id");
64
-
65
- $file = fopen("spec/fixtures/data/group.bin", "w");
66
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
67
- fclose($file);
68
-
69
- $client->ResetGroupBy();
70
-
71
- // distinct
72
- $client->SetGroupDistinct("id");
73
-
74
- $file = fopen("spec/fixtures/data/distinct.bin", "w");
75
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
76
- fclose($file);
77
-
78
- $client->ResetGroupBy();
79
-
80
- // weights
81
- $client->SetWeights(array(100, 1));
82
-
83
- $file = fopen("spec/fixtures/data/weights.bin", "w");
84
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
85
- fclose($file);
86
-
87
- $client->SetWeights(array());
88
-
89
- // anchor
90
- $client->SetGeoAnchor("latitude", "longitude", 10.0, 95.0);
91
-
92
- $file = fopen("spec/fixtures/data/anchor.bin", "w");
93
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
94
- fclose($file);
95
-
96
- $client->ResetFilters();
97
-
98
- // rank_mode
99
- $client->SetRankingMode(SPH_RANK_WORDCOUNT);
100
-
101
- $file = fopen("spec/fixtures/data/rank_mode.bin", "w");
102
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
103
- fclose($file);
104
-
105
- $client->SetRankingMode(SPH_RANK_PROXIMITY_BM25);
106
-
107
- // index_weights
108
- $client->SetIndexWeights(array("people" => 101));
109
-
110
- $file = fopen("spec/fixtures/data/index_weights.bin", "w");
111
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
112
- fclose($file);
113
-
114
- $client->SetIndexWeights(array());
115
-
116
- // index_weights
117
- $client->SetFieldWeights(array("city" => 101));
118
-
119
- $file = fopen("spec/fixtures/data/field_weights.bin", "w");
120
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
121
- fclose($file);
122
-
123
- $client->SetFieldWeights(array());
124
-
125
- // comment
126
- $file = fopen("spec/fixtures/data/comment.bin", "w");
127
- fwrite($file, $client->_reqs[$client->AddQuery("test ", "*", "commenting")]);
128
- fclose($file);
129
-
130
- // update_simple
131
- $file = fopen("spec/fixtures/data/update_simple.bin", "w");
132
- fwrite($file, $client->UpdateAttributes("people", array("birthday"), array(1 => array(191163600))));
133
- fclose($file);
134
-
135
- // keywords_without_hits
136
- $file = fopen("spec/fixtures/data/keywords_without_hits.bin", "w");
137
- fwrite($file, $client->BuildKeywords("pat", "people", false));
138
- fclose($file);
139
-
140
- // keywords_with_hits
141
- $file = fopen("spec/fixtures/data/keywords_with_hits.bin", "w");
142
- fwrite($file, $client->BuildKeywords("pat", "people", true));
143
- fclose($file);
144
-
145
- // overrides
146
- $client->SetOverride("rating", SPH_ATTR_FLOAT, array(1 => 10.0));
147
-
148
- $file = fopen("spec/fixtures/data/overrides.bin", "w");
149
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
150
- fclose($file);
151
-
152
- $client->ResetOverrides();
153
-
154
- // select
155
- $client->SetSelect("selecting");
156
-
157
- $file = fopen("spec/fixtures/data/select.bin", "w");
158
- fwrite($file, $client->_reqs[$client->AddQuery("test ")]);
159
- fclose($file);
160
-
161
- $client->SetSelect("*");
162
-
163
- // filter_array
164
- $client->SetFilter("field", array(1, 2, 3));
165
-
166
- $file = fopen("spec/fixtures/data/filter_array.bin", "w");
167
- fwrite($file, $client->FilterOutput());
168
- fclose($file);
169
-
170
- $client->ResetFilters();
171
-
172
- // filter_array_exclude
173
- $client->SetFilter("field", array(1, 2, 3), true);
174
-
175
- $file = fopen("spec/fixtures/data/filter_array_exclude.bin", "w");
176
- fwrite($file, $client->FilterOutput());
177
- fclose($file);
178
-
179
- $client->ResetFilters();
180
-
181
- // filter_range
182
- $client->SetFilterRange("field", 1, 3);
183
-
184
- $file = fopen("spec/fixtures/data/filter_range.bin", "w");
185
- fwrite($file, $client->FilterOutput());
186
- fclose($file);
187
-
188
- $client->ResetFilters();
189
-
190
- // filter_range_exclude
191
- $client->SetFilterRange("field", 1, 3, true);
192
-
193
- $file = fopen("spec/fixtures/data/filter_range_exclude.bin", "w");
194
- fwrite($file, $client->FilterOutput());
195
- fclose($file);
196
-
197
- $client->ResetFilters();
198
-
199
- // filter_floats
200
- $client->SetFilterFloatRange("field", 5.4, 13.5);
201
-
202
- $file = fopen("spec/fixtures/data/filter_floats.bin", "w");
203
- fwrite($file, $client->FilterOutput());
204
- fclose($file);
205
-
206
- $client->ResetFilters();
207
-
208
- // filter_floats_exclude
209
- $client->SetFilterFloatRange("field", 5.4, 13.5, true);
210
-
211
- $file = fopen("spec/fixtures/data/filter_floats_exclude.bin", "w");
212
- fwrite($file, $client->FilterOutput());
213
- fclose($file);
214
-
215
- $client->ResetFilters();
216
-
217
- // filter_boolean
218
- $client->SetFilter("field", array(0, 1));
219
-
220
- $file = fopen("spec/fixtures/data/filter_boolean.bin", "w");
221
- fwrite($file, $client->FilterOutput());
222
- fclose($file);
223
-
224
- $client->ResetFilters();
225
- ?>