ts-xml 0.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. data/LICENSE +1 -1
  2. data/README.textile +9 -9
  3. data/lib/thinking_sphinx/xml/adapters/oracle_adapter.rb +5 -2
  4. data/lib/thinking_sphinx/xml/tasks.rb +12 -4
  5. metadata +40 -102
  6. data/features/alternate_primary_key.feature +0 -27
  7. data/features/attribute_transformation.feature +0 -22
  8. data/features/attribute_updates.feature +0 -39
  9. data/features/deleting_instances.feature +0 -67
  10. data/features/direct_attributes.feature +0 -11
  11. data/features/excerpts.feature +0 -13
  12. data/features/extensible_delta_indexing.feature +0 -9
  13. data/features/facets.feature +0 -82
  14. data/features/facets_across_model.feature +0 -29
  15. data/features/handling_edits.feature +0 -92
  16. data/features/retry_stale_indexes.feature +0 -24
  17. data/features/searching_across_models.feature +0 -20
  18. data/features/searching_by_index.feature +0 -40
  19. data/features/searching_by_model.feature +0 -175
  20. data/features/searching_with_find_arguments.feature +0 -56
  21. data/features/sphinx_detection.feature +0 -25
  22. data/features/sphinx_scopes.feature +0 -42
  23. data/features/step_definitions/alpha_steps.rb +0 -7
  24. data/features/step_definitions/beta_steps.rb +0 -7
  25. data/features/step_definitions/common_steps.rb +0 -188
  26. data/features/step_definitions/extensible_delta_indexing_steps.rb +0 -7
  27. data/features/step_definitions/facet_steps.rb +0 -96
  28. data/features/step_definitions/find_arguments_steps.rb +0 -36
  29. data/features/step_definitions/gamma_steps.rb +0 -15
  30. data/features/step_definitions/scope_steps.rb +0 -15
  31. data/features/step_definitions/search_steps.rb +0 -89
  32. data/features/step_definitions/sphinx_steps.rb +0 -35
  33. data/features/sti_searching.feature +0 -19
  34. data/features/support/database.example.yml +0 -3
  35. data/features/support/db/fixtures/alphas.rb +0 -10
  36. data/features/support/db/fixtures/authors.rb +0 -1
  37. data/features/support/db/fixtures/betas.rb +0 -10
  38. data/features/support/db/fixtures/boxes.rb +0 -9
  39. data/features/support/db/fixtures/categories.rb +0 -1
  40. data/features/support/db/fixtures/cats.rb +0 -3
  41. data/features/support/db/fixtures/comments.rb +0 -24
  42. data/features/support/db/fixtures/developers.rb +0 -29
  43. data/features/support/db/fixtures/dogs.rb +0 -3
  44. data/features/support/db/fixtures/extensible_betas.rb +0 -10
  45. data/features/support/db/fixtures/foxes.rb +0 -3
  46. data/features/support/db/fixtures/gammas.rb +0 -10
  47. data/features/support/db/fixtures/people.rb +0 -1001
  48. data/features/support/db/fixtures/posts.rb +0 -6
  49. data/features/support/db/fixtures/robots.rb +0 -14
  50. data/features/support/db/fixtures/tags.rb +0 -27
  51. data/features/support/db/migrations/create_alphas.rb +0 -7
  52. data/features/support/db/migrations/create_animals.rb +0 -5
  53. data/features/support/db/migrations/create_authors.rb +0 -3
  54. data/features/support/db/migrations/create_authors_posts.rb +0 -6
  55. data/features/support/db/migrations/create_betas.rb +0 -5
  56. data/features/support/db/migrations/create_boxes.rb +0 -5
  57. data/features/support/db/migrations/create_categories.rb +0 -3
  58. data/features/support/db/migrations/create_comments.rb +0 -10
  59. data/features/support/db/migrations/create_developers.rb +0 -9
  60. data/features/support/db/migrations/create_extensible_betas.rb +0 -5
  61. data/features/support/db/migrations/create_gammas.rb +0 -3
  62. data/features/support/db/migrations/create_people.rb +0 -13
  63. data/features/support/db/migrations/create_posts.rb +0 -5
  64. data/features/support/db/migrations/create_robots.rb +0 -4
  65. data/features/support/db/migrations/create_taggings.rb +0 -5
  66. data/features/support/db/migrations/create_tags.rb +0 -4
  67. data/features/support/env.rb +0 -21
  68. data/features/support/lib/generic_delta_handler.rb +0 -8
  69. data/features/support/models/alpha.rb +0 -21
  70. data/features/support/models/animal.rb +0 -5
  71. data/features/support/models/author.rb +0 -3
  72. data/features/support/models/beta.rb +0 -8
  73. data/features/support/models/box.rb +0 -8
  74. data/features/support/models/cat.rb +0 -3
  75. data/features/support/models/category.rb +0 -4
  76. data/features/support/models/comment.rb +0 -10
  77. data/features/support/models/developer.rb +0 -16
  78. data/features/support/models/dog.rb +0 -3
  79. data/features/support/models/extensible_beta.rb +0 -9
  80. data/features/support/models/fox.rb +0 -5
  81. data/features/support/models/gamma.rb +0 -5
  82. data/features/support/models/person.rb +0 -23
  83. data/features/support/models/post.rb +0 -21
  84. data/features/support/models/robot.rb +0 -12
  85. data/features/support/models/tag.rb +0 -3
  86. data/features/support/models/tagging.rb +0 -4
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Edgars Beigarts
1
+ Copyright (c) 2010 Edgars Beigarts
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,18 +1,18 @@
1
- h1. Support for Oracle, SQLite3 using xmlpipe2 for Thinking Sphinx
1
+ h1. Thinking Sphinx plugin for xmlpipe2 data sources
2
+
3
+ Supports Oracle 10g, MySQL and SQLite3.
2
4
 
3
5
  h2. Installation
4
6
 
5
- You'll need Thinking Sphinx 1.3.0 or later.
7
+ You'll need Thinking Sphinx 1.3.8 or later.
6
8
 
7
- <pre><code>gem install ts-xml --source http://gemcutter.org</code></pre>
9
+ <pre><code>gem install ts-xml</code></pre>
8
10
 
9
11
  In your @environment.rb@ file, with the rest of your gem dependencies:
10
12
 
11
- <pre><code>config.gem 'ts-xml',
12
- :lib => 'thinking_sphinx/xml'
13
- :source => 'http://gemcutter.org'</code></pre>
13
+ <pre><code>config.gem 'ts-xml', :lib => 'thinking_sphinx/xml'</code></pre>
14
14
 
15
- And add the following line to the bottom of your @Rakefile@:
15
+ And add the following lines to the bottom of your @Rakefile@:
16
16
 
17
17
  <pre><code>begin
18
18
  require 'thinking_sphinx/tasks'
@@ -23,8 +23,8 @@ end</code></pre>
23
23
 
24
24
  h2. Usage
25
25
 
26
- TODO
26
+ Just add those lines and it will use xmlpipe2 data source instead of SQL data source.
27
27
 
28
28
  h2. Copyright
29
29
 
30
- Copyright (c) 2009 Edgars Beigarts, and released under an MIT Licence.
30
+ Copyright (c) 2010 Edgars Beigarts, and released under an MIT Licence.
@@ -21,8 +21,12 @@ module ThinkingSphinx
21
21
  "TO_CHAR(#{clause})"
22
22
  end
23
23
 
24
+ # Works the same way as described here:
25
+ # http://github.com/freelancing-god/thinking-sphinx/issues#issue/13
26
+ #
27
+ # With oracle_enhanced you can specify "time_zone" in database.yml
24
28
  def cast_to_datetime(clause)
25
- "(TO_DATE(TO_CHAR(#{clause}, 'YYYY-MON-DD HH24.MI.SS'), 'YYYY-MON-DD HH24.MI.SS') - TO_DATE('01-JAN-1970','DD-MON-YYYY')) * (86400)"
29
+ "((SYSDATE + (#{clause} - timestamp '1970-01-01 00:00:00 +00:00') - SYSDATE) * 86400)"
26
30
  end
27
31
 
28
32
  def cast_to_unsigned(clause)
@@ -39,7 +43,6 @@ module ThinkingSphinx
39
43
  value ? '1' : '0'
40
44
  end
41
45
 
42
- # TODO
43
46
  def crc(clause, blank_to_null = false)
44
47
  "CRC32(#{clause})"
45
48
  end
@@ -1,10 +1,18 @@
1
- require 'thinking_sphinx'
2
- require 'thinking_sphinx/xml'
3
-
4
1
  namespace :thinking_sphinx do
5
2
  # http://www.sphinxsearch.com/docs/current.html#xmlpipe2
6
3
  desc "Streams XML data to STDOUT"
7
- task :xml => :app_env do
4
+ task :xml do
5
+ # Load app environment.
6
+ # Redirect STDOUT ("**Erubis 2.6.5" etc) to STDERR.
7
+ begin
8
+ _stdout = STDOUT.clone
9
+ STDOUT.reopen(STDERR)
10
+ Rake::Task["thinking_sphinx:app_env"].invoke
11
+ ensure
12
+ STDOUT.reopen(_stdout)
13
+ end
14
+ require 'thinking_sphinx'
15
+ require 'thinking_sphinx/xml'
8
16
  # ThinkingSphinx::Configuration.instance.load_models
9
17
  source_name = ENV["NAME"]
10
18
  # STDERR.puts "Source name: #{source_name}"
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts-xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 2
9
+ version: 1.0.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Edgars Beigarts
@@ -9,49 +14,61 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-09 00:00:00 +02:00
17
+ date: 2010-02-24 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: thinking-sphinx
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 3
30
+ - 8
23
31
  version: 1.3.8
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: rspec
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 2
44
+ - 9
33
45
  version: 1.2.9
34
- version:
46
+ type: :development
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: yard
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
43
57
  version: "0"
44
- version:
58
+ type: :development
59
+ version_requirements: *id003
45
60
  - !ruby/object:Gem::Dependency
46
61
  name: cucumber
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
62
+ prerelease: false
63
+ requirement: &id004 !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - ">="
52
66
  - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
53
69
  version: "0"
54
- version:
70
+ type: :development
71
+ version_requirements: *id004
55
72
  description: Support for Oracle, SQLite3 using xmlpipe2 for Thinking Sphinx
56
73
  email: 1@wb4.lv
57
74
  executables: []
@@ -83,101 +100,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
100
  requirements:
84
101
  - - ">="
85
102
  - !ruby/object:Gem::Version
103
+ segments:
104
+ - 0
86
105
  version: "0"
87
- version:
88
106
  required_rubygems_version: !ruby/object:Gem::Requirement
89
107
  requirements:
90
108
  - - ">="
91
109
  - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
92
112
  version: "0"
93
- version:
94
113
  requirements: []
95
114
 
96
115
  rubyforge_project:
97
- rubygems_version: 1.3.5
116
+ rubygems_version: 1.3.6
98
117
  signing_key:
99
118
  specification_version: 3
100
119
  summary: Thinking Sphinx - XML
101
120
  test_files:
102
- - features/alternate_primary_key.feature
103
- - features/attribute_transformation.feature
104
- - features/attribute_updates.feature
105
- - features/deleting_instances.feature
106
- - features/direct_attributes.feature
107
- - features/excerpts.feature
108
- - features/extensible_delta_indexing.feature
109
- - features/facets.feature
110
- - features/facets_across_model.feature
111
- - features/handling_edits.feature
112
- - features/retry_stale_indexes.feature
113
- - features/searching_across_models.feature
114
- - features/searching_by_index.feature
115
- - features/searching_by_model.feature
116
- - features/searching_with_find_arguments.feature
117
- - features/sphinx_detection.feature
118
- - features/sphinx_scopes.feature
119
- - features/step_definitions/alpha_steps.rb
120
- - features/step_definitions/beta_steps.rb
121
- - features/step_definitions/common_steps.rb
122
- - features/step_definitions/extensible_delta_indexing_steps.rb
123
- - features/step_definitions/facet_steps.rb
124
- - features/step_definitions/find_arguments_steps.rb
125
- - features/step_definitions/gamma_steps.rb
126
- - features/step_definitions/scope_steps.rb
127
- - features/step_definitions/search_steps.rb
128
- - features/step_definitions/sphinx_steps.rb
129
- - features/sti_searching.feature
130
- - features/support/database.example.yml
131
- - features/support/db/fixtures/alphas.rb
132
- - features/support/db/fixtures/authors.rb
133
- - features/support/db/fixtures/betas.rb
134
- - features/support/db/fixtures/boxes.rb
135
- - features/support/db/fixtures/categories.rb
136
- - features/support/db/fixtures/cats.rb
137
- - features/support/db/fixtures/comments.rb
138
- - features/support/db/fixtures/developers.rb
139
- - features/support/db/fixtures/dogs.rb
140
- - features/support/db/fixtures/extensible_betas.rb
141
- - features/support/db/fixtures/foxes.rb
142
- - features/support/db/fixtures/gammas.rb
143
- - features/support/db/fixtures/people.rb
144
- - features/support/db/fixtures/posts.rb
145
- - features/support/db/fixtures/robots.rb
146
- - features/support/db/fixtures/tags.rb
147
- - features/support/db/migrations/create_alphas.rb
148
- - features/support/db/migrations/create_animals.rb
149
- - features/support/db/migrations/create_authors.rb
150
- - features/support/db/migrations/create_authors_posts.rb
151
- - features/support/db/migrations/create_betas.rb
152
- - features/support/db/migrations/create_boxes.rb
153
- - features/support/db/migrations/create_categories.rb
154
- - features/support/db/migrations/create_comments.rb
155
- - features/support/db/migrations/create_developers.rb
156
- - features/support/db/migrations/create_extensible_betas.rb
157
- - features/support/db/migrations/create_gammas.rb
158
- - features/support/db/migrations/create_people.rb
159
- - features/support/db/migrations/create_posts.rb
160
- - features/support/db/migrations/create_robots.rb
161
- - features/support/db/migrations/create_taggings.rb
162
- - features/support/db/migrations/create_tags.rb
163
- - features/support/env.rb
164
- - features/support/lib/generic_delta_handler.rb
165
- - features/support/models/alpha.rb
166
- - features/support/models/animal.rb
167
- - features/support/models/author.rb
168
- - features/support/models/beta.rb
169
- - features/support/models/box.rb
170
- - features/support/models/cat.rb
171
- - features/support/models/category.rb
172
- - features/support/models/comment.rb
173
- - features/support/models/developer.rb
174
- - features/support/models/dog.rb
175
- - features/support/models/extensible_beta.rb
176
- - features/support/models/fox.rb
177
- - features/support/models/gamma.rb
178
- - features/support/models/person.rb
179
- - features/support/models/post.rb
180
- - features/support/models/robot.rb
181
- - features/support/models/tag.rb
182
- - features/support/models/tagging.rb
183
121
  - spec/cucumber_env.rb
@@ -1,27 +0,0 @@
1
- Feature: Searching on a single model
2
- In order to use search models with non-integer primary keys
3
- A developer
4
- Should be able to search on a single model
5
-
6
- Scenario: Searching using a basic query
7
- Given Sphinx is running
8
- And I am searching on robots
9
- When I search for Sizzle
10
- Then I should get 2 results
11
-
12
- Scenario: Searching using another basic query
13
- Given Sphinx is running
14
- And I am searching on robots
15
- When I search for fritz
16
- Then I should get 1 result
17
-
18
- Scenario: Deleting an instance
19
- Given Sphinx is running
20
- And I am searching on robots
21
- When I search for Expendable
22
- Then I should get 1 result
23
-
24
- When I destroy robot Expendable
25
- And I wait for Sphinx to catch up
26
- And I search for Expendable
27
- Then I should get 0 results
@@ -1,22 +0,0 @@
1
- Feature: Handle not-quite-supported column types as attributes
2
- In order for Thinking Sphinx to be more understanding with model structures
3
- The plugin
4
- Should be able to use translatable columns as attributes
5
-
6
- Scenario: Decimals as floats
7
- Given Sphinx is running
8
- And I am searching on alphas
9
- When I filter between 1.0 and 3.0 on cost
10
- Then I should get 2 results
11
-
12
- Scenario: Dates as Datetimes
13
- Given Sphinx is running
14
- And I am searching on alphas
15
- When I filter between 1 and 3 days ago on created_on
16
- Then I should get 2 results
17
-
18
- Scenario: Timestamps as Datetimes
19
- Given Sphinx is running
20
- And I am searching on alphas
21
- When I filter between 1 and 3 days ago on created_at
22
- Then I should get 2 results
@@ -1,39 +0,0 @@
1
- Feature: Update attributes directly to Sphinx
2
- In order for updates to be more seamless
3
- The plugin
4
- Should update Sphinx's attributes where possible
5
-
6
- Scenario: Updating attributes in Sphinx without delta indexes
7
- Given Sphinx is running
8
- And I am searching on alphas
9
- When I filter by 3 on value
10
- Then I should get 1 result
11
-
12
- When I change the value of alpha four to 13
13
- And I wait for Sphinx to catch up
14
- And I filter by 13 on value
15
- And I use index alpha_core
16
- Then I should get 1 result
17
- When I use index alternative_core
18
- Then I should get 1 result
19
-
20
- When I change the value of alpha four to 4
21
- And I wait for Sphinx to catch up
22
- And I filter by 13 on value
23
- And I use index alpha_core
24
- Then I should get 0 results
25
- When I use index alternative_core
26
- Then I should get 0 result
27
-
28
- Scenario: Updating attributes in Sphinx with delta indexes
29
- Given Sphinx is running
30
- And I am searching on betas
31
- When I filter by 8 on value
32
- Then I should get 1 result
33
-
34
- When I change the value of beta eight to 18
35
- And I filter by 18 on value
36
- Then I should get 1 result
37
-
38
- When I search for the document id of beta eight in the beta_delta index
39
- Then it should not exist
@@ -1,67 +0,0 @@
1
- Feature: Keeping Sphinx in line with deleted model instances
2
- In order to avoid deleted items being returned by Sphinx
3
- Thinking Sphinx
4
- Should keep deleted items out of search results
5
-
6
- Scenario: Deleting instances from the core index
7
- Given Sphinx is running
8
- And I am searching on betas
9
- When I search for three
10
- Then I should get 1 result
11
-
12
- When I destroy beta three
13
- And I wait for Sphinx to catch up
14
- And I search for three
15
- Then I should get 0 results
16
-
17
- Scenario: Deleting subclasses when the parent class is indexed
18
- Given Sphinx is running
19
- And I am searching on cats
20
- When I search for moggy
21
- Then I should get 1 result
22
-
23
- When I destroy cat moggy
24
- And I wait for Sphinx to catch up
25
- And I search for moggy
26
- Then I should get 0 results
27
-
28
- Scenario: Deleting created instances from the delta index
29
- Given Sphinx is running
30
- And I am searching on betas
31
- When I create a new beta named eleven
32
- And I wait for Sphinx to catch up
33
- And I search for eleven
34
- Then I should get 1 result
35
-
36
- When I destroy beta eleven
37
- And I wait for Sphinx to catch up
38
- And I search for eleven
39
- Then I should get 0 results
40
-
41
- Scenario: Deleting edited instances from the delta index
42
- Given Sphinx is running
43
- And I am searching on betas
44
- When I change the name of beta four to fourteen
45
- And I wait for Sphinx to catch up
46
- And I search for fourteen
47
- Then I should get 1 result
48
-
49
- When I destroy beta fourteen
50
- And I wait for Sphinx to catch up
51
- And I search for fourteen
52
- Then I should get 0 results
53
-
54
- Scenario: Deleting created instances from the delta index when deltas are disabled
55
- Given Sphinx is running
56
- And I am searching on betas
57
- When I create a new beta named thirteen
58
- And I wait for Sphinx to catch up
59
- And I search for thirteen
60
- Then I should get 1 result
61
-
62
- And I disable delta updates
63
- And I destroy beta thirteen
64
- And I wait for Sphinx to catch up
65
- And I enable delta updates
66
- And I search for thirteen
67
- Then I should get 0 results