dusen 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/dusen/util.rb CHANGED
@@ -118,7 +118,7 @@ module Dusen
118
118
  #end
119
119
 
120
120
  def normalize_word_boundaries(text)
121
- unwanted_mysql_boundary = /[\.;]/
121
+ unwanted_mysql_boundary = /[\.;\-]/
122
122
  text.gsub(unwanted_mysql_boundary, '')
123
123
  end
124
124
 
data/lib/dusen/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Dusen
4
- VERSION = '0.4.3'
4
+ VERSION = '0.4.4'
5
5
  end
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~>2.3'
4
4
  gem 'rspec', '~>1.3'
@@ -2,5 +2,5 @@ test:
2
2
  adapter: mysql2
3
3
  host: localhost
4
4
  username: root
5
- password: foobar
5
+ password: junior
6
6
  database: dusen_test
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~>3.0.17'
4
4
  gem 'rspec'
@@ -2,5 +2,5 @@ test:
2
2
  adapter: mysql2
3
3
  host: localhost
4
4
  username: root
5
- password: foobar
5
+ password: junior
6
6
  database: dusen_test
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~>3.2.0'
4
4
  gem 'rspec'
@@ -2,5 +2,5 @@ test:
2
2
  adapter: mysql2
3
3
  host: localhost
4
4
  username: root
5
- password: foobar
5
+ password: junior
6
6
  database: dusen_test
@@ -64,10 +64,15 @@ shared_examples_for 'model with search syntax' do
64
64
  it 'should find words where one letter is separated from other letters by a period' do
65
65
  match = subject.create!(:name => 'E;ONNNEN')
66
66
  subject.search('E;ONNNEN')
67
- # debugger
68
67
  subject.search('E;ONNNEN').to_a.should == [match]
69
68
  end
70
69
 
70
+ it 'should distinguish between "Baden" and "Baden-Baden" (bugfix)' do
71
+ match = subject.create!(:city => 'Baden-Baden')
72
+ no_match = subject.create!(:city => 'Baden')
73
+ subject.search('Baden-Baden').all.should == [match]
74
+ end
75
+
71
76
  end
72
77
 
73
78
  describe '.search_syntax' do
@@ -9,6 +9,11 @@ describe Dusen::Parser do
9
9
  query.collect(&:value).should == ['field1-value', 'field2-value', 'word1', 'word2']
10
10
  end
11
11
 
12
+ it 'should not consider the dash to be a word boundary' do
13
+ query = Dusen::Parser.parse('Baden-Baden')
14
+ query.collect(&:value).should == ['Baden-Baden']
15
+ end
16
+
12
17
  end
13
18
 
14
19
  end
@@ -24,6 +24,7 @@ describe Dusen::Util do
24
24
  Dusen::Util.normalize_word_boundaries("E.ON Bayern").should == 'EON Bayern'
25
25
  Dusen::Util.normalize_word_boundaries("E.ON E.ON").should == 'EON EON'
26
26
  Dusen::Util.normalize_word_boundaries("E;ON").should == 'EON'
27
+ Dusen::Util.normalize_word_boundaries("Baden-Baden").should == 'BadenBaden'
27
28
  end
28
29
 
29
30
  it 'should remove characters that MySQL would mistakenly consider a word boundary' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dusen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 3
10
- version: 0.4.3
9
+ - 4
10
+ version: 0.4.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-14 00:00:00 Z
18
+ date: 2013-03-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -161,10 +161,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  requirements: []
162
162
 
163
163
  rubyforge_project:
164
- rubygems_version: 1.8.24
164
+ rubygems_version: 1.8.25
165
165
  signing_key:
166
166
  specification_version: 3
167
167
  summary: Comprehensive full text search for ActiveRecord and MySQL
168
168
  test_files: []
169
169
 
170
- has_rdoc: