rlibsphinxclient 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG.rdoc +18 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +151 -0
  5. data/Rakefile +39 -0
  6. data/VERSION +1 -0
  7. data/ext/extconf.rb +20 -0
  8. data/ext/rlibsphinxclient.i +314 -0
  9. data/ext/rlibsphinxclient_wrap.c +5931 -0
  10. data/init.rb +1 -0
  11. data/lib/sphinx.rb +22 -0
  12. data/lib/sphinx/client.rb +1070 -0
  13. data/lib/sphinx/fast_client.rb +184 -0
  14. data/lib/sphinx/request.rb +49 -0
  15. data/lib/sphinx/response.rb +69 -0
  16. data/lib/sphinx/safe_executor.rb +11 -0
  17. data/lib/sphinx/timeout.rb +9 -0
  18. data/rlibsphinxclient.gemspec +117 -0
  19. data/spec/client_response_spec.rb +135 -0
  20. data/spec/client_spec.rb +548 -0
  21. data/spec/fixtures/default_search.php +8 -0
  22. data/spec/fixtures/default_search_index.php +8 -0
  23. data/spec/fixtures/excerpt_custom.php +11 -0
  24. data/spec/fixtures/excerpt_default.php +8 -0
  25. data/spec/fixtures/excerpt_flags.php +11 -0
  26. data/spec/fixtures/field_weights.php +9 -0
  27. data/spec/fixtures/filter.php +9 -0
  28. data/spec/fixtures/filter_exclude.php +9 -0
  29. data/spec/fixtures/filter_float_range.php +9 -0
  30. data/spec/fixtures/filter_float_range_exclude.php +9 -0
  31. data/spec/fixtures/filter_range.php +9 -0
  32. data/spec/fixtures/filter_range_exclude.php +9 -0
  33. data/spec/fixtures/filter_ranges.php +10 -0
  34. data/spec/fixtures/filters.php +10 -0
  35. data/spec/fixtures/filters_different.php +13 -0
  36. data/spec/fixtures/geo_anchor.php +9 -0
  37. data/spec/fixtures/group_by_attr.php +9 -0
  38. data/spec/fixtures/group_by_attrpair.php +9 -0
  39. data/spec/fixtures/group_by_day.php +9 -0
  40. data/spec/fixtures/group_by_day_sort.php +9 -0
  41. data/spec/fixtures/group_by_month.php +9 -0
  42. data/spec/fixtures/group_by_week.php +9 -0
  43. data/spec/fixtures/group_by_year.php +9 -0
  44. data/spec/fixtures/group_distinct.php +10 -0
  45. data/spec/fixtures/id_range.php +9 -0
  46. data/spec/fixtures/id_range64.php +9 -0
  47. data/spec/fixtures/index_weights.php +9 -0
  48. data/spec/fixtures/keywords.php +8 -0
  49. data/spec/fixtures/limits.php +9 -0
  50. data/spec/fixtures/limits_cutoff.php +9 -0
  51. data/spec/fixtures/limits_max.php +9 -0
  52. data/spec/fixtures/limits_max_cutoff.php +9 -0
  53. data/spec/fixtures/match_all.php +9 -0
  54. data/spec/fixtures/match_any.php +9 -0
  55. data/spec/fixtures/match_boolean.php +9 -0
  56. data/spec/fixtures/match_extended.php +9 -0
  57. data/spec/fixtures/match_extended2.php +9 -0
  58. data/spec/fixtures/match_fullscan.php +9 -0
  59. data/spec/fixtures/match_phrase.php +9 -0
  60. data/spec/fixtures/max_query_time.php +9 -0
  61. data/spec/fixtures/miltiple_queries.php +12 -0
  62. data/spec/fixtures/ranking_bm25.php +9 -0
  63. data/spec/fixtures/ranking_none.php +9 -0
  64. data/spec/fixtures/ranking_proximity_bm25.php +9 -0
  65. data/spec/fixtures/ranking_wordcount.php +9 -0
  66. data/spec/fixtures/retries.php +9 -0
  67. data/spec/fixtures/retries_delay.php +9 -0
  68. data/spec/fixtures/sort_attr_asc.php +9 -0
  69. data/spec/fixtures/sort_attr_desc.php +9 -0
  70. data/spec/fixtures/sort_expr.php +9 -0
  71. data/spec/fixtures/sort_extended.php +9 -0
  72. data/spec/fixtures/sort_relevance.php +9 -0
  73. data/spec/fixtures/sort_time_segments.php +9 -0
  74. data/spec/fixtures/sphinxapi.php +1181 -0
  75. data/spec/fixtures/update_attributes.php +8 -0
  76. data/spec/fixtures/weights.php +9 -0
  77. data/spec/sphinx/sphinx.conf +67 -0
  78. data/spec/sphinx/sphinx_test.sql +86 -0
  79. metadata +133 -0
@@ -0,0 +1,8 @@
1
+ <?php
2
+
3
+ require ("sphinxapi.php");
4
+
5
+ $cl = new SphinxClient();
6
+ $cl->UpdateAttributes('index', array('group'), array(123 => array(456)));
7
+
8
+ ?>
@@ -0,0 +1,9 @@
1
+ <?php
2
+
3
+ require ("sphinxapi.php");
4
+
5
+ $cl = new SphinxClient();
6
+ $cl->SetWeights(array(10, 20, 30, 40));
7
+ $cl->Query('query');
8
+
9
+ ?>
@@ -0,0 +1,67 @@
1
+ source src1
2
+ {
3
+ type = mysql
4
+ sql_host = localhost
5
+ sql_user = root
6
+ sql_pass =
7
+ sql_db = sphinx_test
8
+ sql_port = 3306 # optional, default is 3306
9
+
10
+ sql_query = SELECT id, name, description, UNIX_TIMESTAMP(created_at) AS created_at, group_id, rating FROM links
11
+ sql_attr_uint = group_id
12
+ sql_attr_timestamp = created_at
13
+ sql_attr_float = rating
14
+ sql_attr_multi = uint tags from query; SELECT link_id, tag_id FROM links_tags
15
+ sql_query_info = SELECT * FROM links WHERE id=$id
16
+ }
17
+
18
+ source src2
19
+ {
20
+ type = mysql
21
+ sql_host = localhost
22
+ sql_user = root
23
+ sql_pass =
24
+ sql_db = sphinx_test
25
+ sql_port = 3306 # optional, default is 3306
26
+
27
+ sql_query = SELECT id, name, description, UNIX_TIMESTAMP(created_at) AS created_at, group_id FROM links64
28
+ sql_attr_uint = group_id
29
+ sql_attr_timestamp = created_at
30
+ sql_query_info = SELECT * FROM links WHERE id=$id
31
+ }
32
+
33
+ index test1
34
+ {
35
+ source = src1
36
+ path = /opt/sphinx-0.9.9/var/data/test1
37
+ docinfo = extern
38
+ morphology = none
39
+ stopwords =
40
+ charset_type = utf-8
41
+ }
42
+
43
+ index test2
44
+ {
45
+ source = src2
46
+ path = /opt/sphinx-0.9.9/var/data/test2
47
+ docinfo = extern
48
+ morphology = none
49
+ stopwords =
50
+ charset_type = utf-8
51
+ }
52
+
53
+ indexer
54
+ {
55
+ mem_limit = 32M
56
+ }
57
+
58
+ searchd
59
+ {
60
+ port = 3312
61
+ log = /opt/sphinx-0.9.9/var/log/searchd.log
62
+ query_log = /opt/sphinx-0.9.9/var/log/query.log
63
+ read_timeout = 5
64
+ max_children = 30
65
+ pid_file = /opt/sphinx-0.9.9/var/log/searchd.pid
66
+ max_matches = 1000
67
+ }
@@ -0,0 +1,86 @@
1
+ /*
2
+ SQLyog Enterprise - MySQL GUI v5.20
3
+ Host - 5.0.27-community-nt : Database - sphinx_test
4
+ *********************************************************************
5
+ Server version : 5.0.27-community-nt
6
+ */
7
+
8
+ SET NAMES utf8;
9
+
10
+ SET SQL_MODE='';
11
+
12
+ CREATE database IF NOT EXISTS `sphinx_test`;
13
+
14
+ USE `sphinx_test`;
15
+
16
+ /* Table structure for table `links` */
17
+
18
+ DROP TABLE IF EXISTS `links`;
19
+
20
+ CREATE TABLE `links` (
21
+ `id` INT(11) NOT NULL auto_increment,
22
+ `name` VARCHAR(255) NOT NULL,
23
+ `created_at` DATETIME NOT NULL,
24
+ `description` TEXT,
25
+ `group_id` INT(11) NOT NULL,
26
+ `rating` FLOAT NOT NULL,
27
+ PRIMARY KEY (`id`)
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
29
+
30
+ /* Table structure for table `tags` */
31
+
32
+ DROP TABLE IF EXISTS `tags`;
33
+
34
+ CREATE TABLE `tags` (
35
+ `id` INT(11) NOT NULL auto_increment,
36
+ `tag` VARCHAR(255) NOT NULL,
37
+ PRIMARY KEY (`id`)
38
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39
+
40
+ /* Table structure for table `links_tags` */
41
+
42
+ DROP TABLE IF EXISTS `links_tags`;
43
+
44
+ CREATE TABLE `links_tags` (
45
+ `link_id` INT(11) NOT NULL,
46
+ `tag_id` INT(11) NOT NULL,
47
+ PRIMARY KEY (`link_id`,`tag_id`)
48
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
49
+
50
+ /* Table structure for table `links64` */
51
+
52
+ DROP TABLE IF EXISTS `links64`;
53
+
54
+ CREATE TABLE `links64` (
55
+ `id` BIGINT(11) NOT NULL auto_increment,
56
+ `name` VARCHAR(255) NOT NULL,
57
+ `created_at` DATETIME NOT NULL,
58
+ `description` TEXT,
59
+ `group_id` INT(11) NOT NULL,
60
+ PRIMARY KEY (`id`)
61
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
62
+
63
+ /* Data for the table `links` */
64
+
65
+ INSERT INTO `links`(`id`,`name`,`created_at`,`description`,`group_id`,`rating`) VALUES
66
+ (1,'Paint Protects WiFi Network from Hackers','2007-04-04 06:48:10','A company known as SEC Technologies has created a special type of paint that blocks Wi-Fi signals so that you can be sure hackers can ',1,13.32),
67
+ (2,'Airplanes To Become WiFi Hotspots','2007-04-04 06:49:15','Airlines will start turning their airplanes into WiFi hotspots beginning early next year, WSJ reports. Here\'s what you need to know...',2,54.85),
68
+ (3,'Planet VIP-195 GSM/WiFi Phone With Windows Messanger','2007-04-04 06:50:47','The phone does comply with IEEE 802.11b and IEEE 802.11g to provide phone capability via WiFi. As GSM phone the VIP-195 support 900/1800/1900 band and GPRS too. It comes with simple button to switch between WiFi or GSM mod',1,16.25);
69
+
70
+ /* Data for the table `tags` */
71
+ INSERT INTO `tags`(`id`,`tag`) VALUES
72
+ (1, 'tag1'),(2, 'tag2'),(3, 'tag3'),(4, 'tag4'),(5, 'tag5'),
73
+ (6, 'tag6'),(7, 'tag7'),(8, 'tag8'),(9, 'tag9'),(10, 'tag5');
74
+
75
+ /* Data for the table `links_tags` */
76
+ INSERT INTO `links_tags`(`link_id`,`tag_id`) VALUES
77
+ (1, 1),(1, 2),(1, 3),(1, 4),
78
+ (2, 5),(2, 6),(2, 7),(2, 8),
79
+ (3, 9),(3, 1),(3, 7),(3, 10);
80
+
81
+ /* Data for the table `links64` */
82
+
83
+ INSERT INTO `links64`(`id`,`name`,`created_at`,`description`,`group_id`) VALUES
84
+ (4294967297,'Paint Protects WiFi Network from Hackers','2007-04-04 06:48:10','A company known as SEC Technologies has created a special type of paint that blocks Wi-Fi signals so that you can be sure hackers can ',1),
85
+ (4294967298,'Airplanes To Become WiFi Hotspots','2007-04-04 06:49:15','Airlines will start turning their airplanes into WiFi hotspots beginning early next year, WSJ reports. Here\'s what you need to know...',2),
86
+ (4294967299,'Planet VIP-195 GSM/WiFi Phone With Windows Messanger','2007-04-04 06:50:47','The phone does comply with IEEE 802.11b and IEEE 802.11g to provide phone capability via WiFi. As GSM phone the VIP-195 support 900/1800/1900 band and GPRS too. It comes with simple button to switch between WiFi or GSM mod',1);
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rlibsphinxclient
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ platform: ruby
6
+ authors:
7
+ - Dmytro Shteflyuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-15 00:00:00 +03:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: kpumuk@kpumuk.info
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - .gitignore
26
+ - CHANGELOG.rdoc
27
+ - MIT-LICENSE
28
+ - README.rdoc
29
+ - Rakefile
30
+ - VERSION
31
+ - ext/extconf.rb
32
+ - ext/rlibsphinxclient.i
33
+ - ext/rlibsphinxclient_wrap.c
34
+ - init.rb
35
+ - lib/sphinx.rb
36
+ - lib/sphinx/client.rb
37
+ - lib/sphinx/fast_client.rb
38
+ - lib/sphinx/request.rb
39
+ - lib/sphinx/response.rb
40
+ - lib/sphinx/safe_executor.rb
41
+ - lib/sphinx/timeout.rb
42
+ - rlibsphinxclient.gemspec
43
+ - spec/client_response_spec.rb
44
+ - spec/client_spec.rb
45
+ - spec/fixtures/default_search.php
46
+ - spec/fixtures/default_search_index.php
47
+ - spec/fixtures/excerpt_custom.php
48
+ - spec/fixtures/excerpt_default.php
49
+ - spec/fixtures/excerpt_flags.php
50
+ - spec/fixtures/field_weights.php
51
+ - spec/fixtures/filter.php
52
+ - spec/fixtures/filter_exclude.php
53
+ - spec/fixtures/filter_float_range.php
54
+ - spec/fixtures/filter_float_range_exclude.php
55
+ - spec/fixtures/filter_range.php
56
+ - spec/fixtures/filter_range_exclude.php
57
+ - spec/fixtures/filter_ranges.php
58
+ - spec/fixtures/filters.php
59
+ - spec/fixtures/filters_different.php
60
+ - spec/fixtures/geo_anchor.php
61
+ - spec/fixtures/group_by_attr.php
62
+ - spec/fixtures/group_by_attrpair.php
63
+ - spec/fixtures/group_by_day.php
64
+ - spec/fixtures/group_by_day_sort.php
65
+ - spec/fixtures/group_by_month.php
66
+ - spec/fixtures/group_by_week.php
67
+ - spec/fixtures/group_by_year.php
68
+ - spec/fixtures/group_distinct.php
69
+ - spec/fixtures/id_range.php
70
+ - spec/fixtures/id_range64.php
71
+ - spec/fixtures/index_weights.php
72
+ - spec/fixtures/keywords.php
73
+ - spec/fixtures/limits.php
74
+ - spec/fixtures/limits_cutoff.php
75
+ - spec/fixtures/limits_max.php
76
+ - spec/fixtures/limits_max_cutoff.php
77
+ - spec/fixtures/match_all.php
78
+ - spec/fixtures/match_any.php
79
+ - spec/fixtures/match_boolean.php
80
+ - spec/fixtures/match_extended.php
81
+ - spec/fixtures/match_extended2.php
82
+ - spec/fixtures/match_fullscan.php
83
+ - spec/fixtures/match_phrase.php
84
+ - spec/fixtures/max_query_time.php
85
+ - spec/fixtures/miltiple_queries.php
86
+ - spec/fixtures/ranking_bm25.php
87
+ - spec/fixtures/ranking_none.php
88
+ - spec/fixtures/ranking_proximity_bm25.php
89
+ - spec/fixtures/ranking_wordcount.php
90
+ - spec/fixtures/retries.php
91
+ - spec/fixtures/retries_delay.php
92
+ - spec/fixtures/sort_attr_asc.php
93
+ - spec/fixtures/sort_attr_desc.php
94
+ - spec/fixtures/sort_expr.php
95
+ - spec/fixtures/sort_extended.php
96
+ - spec/fixtures/sort_relevance.php
97
+ - spec/fixtures/sort_time_segments.php
98
+ - spec/fixtures/sphinxapi.php
99
+ - spec/fixtures/update_attributes.php
100
+ - spec/fixtures/weights.php
101
+ - spec/sphinx/sphinx.conf
102
+ - spec/sphinx/sphinx_test.sql
103
+ has_rdoc: true
104
+ homepage: http://github.com/kpumuk/rlibsphinxclient
105
+ licenses: []
106
+
107
+ post_install_message:
108
+ rdoc_options:
109
+ - --charset=UTF-8
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: "0"
117
+ version:
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ version:
124
+ requirements: []
125
+
126
+ rubyforge_project:
127
+ rubygems_version: 1.3.5
128
+ signing_key:
129
+ specification_version: 3
130
+ summary: A Ruby wrapper for pure C searchd client API library.
131
+ test_files:
132
+ - spec/client_response_spec.rb
133
+ - spec/client_spec.rb