riddle 0.9.8.1533.10 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/README.textile +1 -0
  2. data/lib/riddle.rb +9 -15
  3. data/lib/riddle/0.9.8.rb +0 -0
  4. data/lib/riddle/0.9.9.rb +5 -0
  5. data/lib/riddle/0.9.9/client.rb +49 -0
  6. data/lib/riddle/0.9.9/client/filter.rb +22 -0
  7. data/lib/riddle/0.9.9/configuration/searchd.rb +28 -0
  8. data/lib/riddle/client.rb +110 -18
  9. data/lib/riddle/client/filter.rb +29 -20
  10. data/lib/riddle/client/message.rb +4 -0
  11. data/lib/riddle/client/response.rb +10 -0
  12. data/lib/riddle/configuration/distributed_index.rb +8 -7
  13. data/lib/riddle/configuration/index.rb +15 -11
  14. data/lib/riddle/configuration/searchd.rb +6 -4
  15. data/lib/riddle/configuration/sql_source.rb +9 -4
  16. data/lib/riddle/controller.rb +5 -3
  17. data/spec/fixtures/data_generator.0.9.8.php +208 -0
  18. data/spec/fixtures/data_generator.0.9.9.php +225 -0
  19. data/spec/fixtures/sphinx/configuration.erb +38 -0
  20. data/spec/fixtures/sphinx/people.spa +0 -0
  21. data/spec/fixtures/sphinx/people.spd +0 -0
  22. data/spec/fixtures/sphinx/people.sph +0 -0
  23. data/spec/fixtures/sphinx/people.spi +0 -0
  24. data/spec/fixtures/sphinx/people.spk +0 -0
  25. data/spec/fixtures/sphinx/people.spm +0 -0
  26. data/spec/fixtures/sphinx/people.spp +0 -0
  27. data/spec/fixtures/sphinx/searchd.log +3731 -0
  28. data/spec/fixtures/sphinx/searchd.query.log +1032 -0
  29. data/spec/fixtures/sphinx/spec.conf +38 -0
  30. data/spec/fixtures/sphinxapi.0.9.8.php +1228 -0
  31. data/spec/fixtures/sphinxapi.0.9.9.php +1646 -0
  32. data/spec/fixtures/sql/conf.example.yml +3 -0
  33. data/spec/fixtures/sql/conf.yml +3 -0
  34. data/spec/fixtures/sql/data.sql +25000 -0
  35. data/spec/fixtures/sql/structure.sql +16 -0
  36. data/spec/functional/excerpt_spec.rb +37 -10
  37. data/spec/functional/persistance_spec.rb +17 -0
  38. data/spec/functional/status_spec.rb +21 -0
  39. data/spec/functional/update_spec.rb +3 -3
  40. data/spec/spec_helper.rb +30 -0
  41. data/spec/sphinx_helper.rb +93 -0
  42. data/spec/unit/client_spec.rb +20 -3
  43. data/spec/unit/configuration/distributed_index_spec.rb +2 -0
  44. data/spec/unit/configuration/index_spec.rb +16 -0
  45. data/spec/unit/configuration/searchd_spec.rb +46 -13
  46. data/spec/unit/configuration/sql_source_spec.rb +15 -0
  47. metadata +61 -37
  48. data/MIT-LICENCE +0 -20
  49. data/lib/tabtab_definitions.rb +0 -15
@@ -35,6 +35,10 @@ module Riddle
35
35
  @message << [float].pack('f').unpack('L*').pack("N")
36
36
  end
37
37
 
38
+ def append_boolean(bool)
39
+ append_int(bool ? 1 : 0)
40
+ end
41
+
38
42
  # Append multiple integers
39
43
  def append_ints(*ints)
40
44
  ints.each { |int| append_int(int) }
@@ -75,6 +75,16 @@ module Riddle
75
75
  return items
76
76
  end
77
77
 
78
+ def next_64bit_int_array
79
+ count = next_int
80
+ items = []
81
+ for i in 0...count
82
+ items << self.next_64bit_int
83
+ end
84
+
85
+ return items
86
+ end
87
+
78
88
  # Returns the length of the streamed data
79
89
  def length
80
90
  @str.length
@@ -1,16 +1,17 @@
1
1
  module Riddle
2
2
  class Configuration
3
3
  class DistributedIndex < Riddle::Configuration::Section
4
- self.settings = [:type, :local, :agent, :agent_connect_timeout,
5
- :agent_query_timeout]
4
+ self.settings = [:type, :local, :agent, :agent_blackhole,
5
+ :agent_connect_timeout, :agent_query_timeout]
6
6
 
7
- attr_accessor :name, :local_indexes, :remote_indexes,
7
+ attr_accessor :name, :local_indexes, :remote_indexes, :agent_blackhole,
8
8
  :agent_connect_timeout, :agent_query_timeout
9
9
 
10
10
  def initialize(name)
11
- @name = name
12
- @local_indexes = []
13
- @remote_indexes = []
11
+ @name = name
12
+ @local_indexes = []
13
+ @remote_indexes = []
14
+ @agent_blackhole = []
14
15
  end
15
16
 
16
17
  def type
@@ -29,7 +30,7 @@ module Riddle
29
30
  }.collect { |index| index.name }.join(",")
30
31
  }
31
32
  end
32
-
33
+
33
34
  def render
34
35
  raise ConfigurationError unless valid?
35
36
 
@@ -2,19 +2,23 @@ module Riddle
2
2
  class Configuration
3
3
  class Index < Riddle::Configuration::Section
4
4
  self.settings = [:source, :path, :docinfo, :mlock, :morphology,
5
- :stopwords, :wordforms, :exceptions, :min_word_len, :charset_type,
6
- :charset_table, :ignore_chars, :min_prefix_len, :min_infix_len,
7
- :prefix_fields, :infix_fields, :enable_star, :ngram_len, :ngram_chars,
8
- :phrase_boundary, :phrase_boundary_step, :html_strip,
9
- :html_index_attrs, :html_remove_elements, :preopen]
5
+ :min_stemming_len, :stopwords, :wordforms, :exceptions, :min_word_len,
6
+ :charset_type, :charset_table, :ignore_chars, :min_prefix_len,
7
+ :min_infix_len, :prefix_fields, :infix_fields, :enable_star,
8
+ :ngram_len, :ngram_chars, :phrase_boundary, :phrase_boundary_step,
9
+ :html_strip, :html_index_attrs, :html_remove_elements, :preopen,
10
+ :ondisk_dict, :inplace_enable, :inplace_hit_gap, :inplace_docinfo_gap,
11
+ :inplace_reloc_factor, :inplace_write_factor, :index_exact_words]
10
12
 
11
13
  attr_accessor :name, :parent, :sources, :path, :docinfo, :mlock,
12
- :morphologies, :stopword_files, :wordform_files, :exception_files,
13
- :min_word_len, :charset_type, :charset_table, :ignore_characters,
14
- :min_prefix_len, :min_infix_len, :prefix_field_names,
15
- :infix_field_names, :enable_star, :ngram_len, :ngram_characters,
16
- :phrase_boundaries, :phrase_boundary_step, :html_strip,
17
- :html_index_attrs, :html_remove_element_tags, :preopen
14
+ :morphologies, :min_stemming_len, :stopword_files, :wordform_files,
15
+ :exception_files, :min_word_len, :charset_type, :charset_table,
16
+ :ignore_characters, :min_prefix_len, :min_infix_len,
17
+ :prefix_field_names, :infix_field_names, :enable_star, :ngram_len,
18
+ :ngram_characters, :phrase_boundaries, :phrase_boundary_step,
19
+ :html_strip, :html_index_attrs, :html_remove_element_tags, :preopen,
20
+ :ondisk_dict, :inplace_enable, :inplace_hit_gap, :inplace_docinfo_gap,
21
+ :inplace_reloc_factor, :inplace_write_factor, :index_exact_words
18
22
 
19
23
  def initialize(name, *sources)
20
24
  @name = name
@@ -1,9 +1,11 @@
1
1
  module Riddle
2
2
  class Configuration
3
3
  class Searchd < Riddle::Configuration::Section
4
- self.settings = [:address, :port, :log, :query_log, :read_timeout,
5
- :max_children, :pid_file, :max_matches, :seamless_rotate,
6
- :preopen_indexes, :unlink_old]
4
+ self.settings = [:listen, :address, :port, :log, :query_log,
5
+ :read_timeout, :client_timeout, :max_children, :pid_file, :max_matches,
6
+ :seamless_rotate, :preopen_indexes, :unlink_old, :attr_flush_period,
7
+ :ondisk_dict_default, :max_packet_size, :mva_updates_pool,
8
+ :crash_log_path, :max_filters, :max_filter_values]
7
9
 
8
10
  attr_accessor *self.settings
9
11
 
@@ -22,4 +24,4 @@ module Riddle
22
24
  end
23
25
  end
24
26
  end
25
- end
27
+ end
@@ -3,10 +3,12 @@ module Riddle
3
3
  class SQLSource < Riddle::Configuration::Source
4
4
  self.settings = [:type, :sql_host, :sql_user, :sql_pass, :sql_db,
5
5
  :sql_port, :sql_sock, :mysql_connect_flags, :sql_query_pre, :sql_query,
6
- :sql_query_range, :sql_range_step, :sql_attr_uint, :sql_attr_bool,
7
- :sql_attr_timestamp, :sql_attr_str2ordinal, :sql_attr_float,
8
- :sql_attr_multi, :sql_query_post, :sql_query_post_index,
9
- :sql_ranged_throttle, :sql_query_info]
6
+ :sql_query_range, :sql_range_step, :sql_query_killlist, :sql_attr_uint,
7
+ :sql_attr_bool, :sql_attr_bigint, :sql_attr_timestamp,
8
+ :sql_attr_str2ordinal, :sql_attr_float, :sql_attr_multi,
9
+ :sql_query_post, :sql_query_post_index, :sql_ranged_throttle,
10
+ :sql_query_info, :mssql_winauth, :mssql_unicode, :unpack_zlib,
11
+ :unpack_mysqlcompress, :unpack_mysqlcompress_maxsize]
10
12
 
11
13
  attr_accessor *self.settings
12
14
 
@@ -17,12 +19,15 @@ module Riddle
17
19
  @sql_query_pre = []
18
20
  @sql_attr_uint = []
19
21
  @sql_attr_bool = []
22
+ @sql_attr_bigint = []
20
23
  @sql_attr_timestamp = []
21
24
  @sql_attr_str2ordinal = []
22
25
  @sql_attr_float = []
23
26
  @sql_attr_multi = []
24
27
  @sql_query_post = []
25
28
  @sql_query_post_index = []
29
+ @unpack_zlib = []
30
+ @unpack_mysqlcompress = []
26
31
  end
27
32
 
28
33
  def valid?
@@ -5,8 +5,10 @@ module Riddle
5
5
  @path = path
6
6
  end
7
7
 
8
- def index
9
- cmd = "indexer --config #{@path} --all"
8
+ def index(*indexes)
9
+ indexes << '--all' if indexes.empty?
10
+
11
+ cmd = "indexer --config #{@path} #{indexes.join(' ')}"
10
12
  cmd << " --rotate" if running?
11
13
  `#{cmd}`
12
14
  end
@@ -50,4 +52,4 @@ module Riddle
50
52
  false
51
53
  end
52
54
  end
53
- end
55
+ end
@@ -0,0 +1,208 @@
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
+ ?>
@@ -0,0 +1,225 @@
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
+ ?>