dusen 0.4.8 → 0.4.9
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.
- data/.ruby-version +1 -0
- data/README.md +10 -0
- data/Rakefile +1 -1
- data/lib/dusen/syntax.rb +7 -1
- data/lib/dusen/version.rb +1 -1
- data/spec/rails-2.3/Gemfile.lock +1 -1
- data/spec/rails-3.0/Gemfile.lock +1 -1
- data/spec/rails-3.2/Gemfile.lock +1 -1
- data/spec/shared/spec/dusen/active_record/base_ext_spec.rb +5 -0
- metadata +5 -5
- data/.rvmrc +0 -2
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.8.7
|
data/README.md
CHANGED
@@ -130,6 +130,16 @@ Note that you can combine text tokens and field tokens:
|
|
130
130
|
|
131
131
|
> Contact.search('fooville email:foo@bar.com')
|
132
132
|
=> Contact.where_like(columns => 'fooville').where(:email => 'foo@bar.com')
|
133
|
+
|
134
|
+
### Caveat
|
135
|
+
|
136
|
+
If you search for a phrase containing a colon (e.g. `deploy:rollback`), Dusen
|
137
|
+
will mistake the first part as a – nonexistent – qualifier and return an empty
|
138
|
+
set.
|
139
|
+
|
140
|
+
To prevent that, prefix your query with the default qualifier `text`:
|
141
|
+
|
142
|
+
text:deploy:rollback
|
133
143
|
|
134
144
|
|
135
145
|
Processing full text queries with FULLTEXT indexes
|
data/Rakefile
CHANGED
data/lib/dusen/syntax.rb
CHANGED
@@ -38,7 +38,13 @@ module Dusen
|
|
38
38
|
private
|
39
39
|
|
40
40
|
DEFAULT_UNKNOWN_SCOPER = lambda do |scope, *args|
|
41
|
-
scope.where
|
41
|
+
if scope.respond_to?(:where)
|
42
|
+
# Rails 3
|
43
|
+
scope.where('1=2')
|
44
|
+
else
|
45
|
+
# Rails 2
|
46
|
+
scope.scoped(:conditions => ['1=2'])
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
def unknown_scoper
|
data/lib/dusen/version.rb
CHANGED
data/spec/rails-2.3/Gemfile.lock
CHANGED
data/spec/rails-3.0/Gemfile.lock
CHANGED
data/spec/rails-3.2/Gemfile.lock
CHANGED
@@ -38,6 +38,11 @@ shared_examples_for 'model with search syntax' do
|
|
38
38
|
subject.search('email:foo@bar.com').to_a.should == [match]
|
39
39
|
end
|
40
40
|
|
41
|
+
it 'should find no records if a nonexistent qualifier is used' do
|
42
|
+
subject.create!(:name => 'someuser', :email => 'foo@bar.com')
|
43
|
+
subject.search('nonexistent_qualifier:someuser email:foo@bar.com').to_a.should == []
|
44
|
+
end
|
45
|
+
|
41
46
|
it 'should allow phrases as values for qualified field queries' do
|
42
47
|
match = subject.create!(:name => 'Foo Bar', :city => 'Foo Bar')
|
43
48
|
no_match = subject.create!(:name => 'Foo Bar', :city => 'Bar Foo')
|
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:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 9
|
10
|
+
version: 0.4.9
|
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:
|
18
|
+
date: 2014-01-24 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -58,7 +58,7 @@ extra_rdoc_files: []
|
|
58
58
|
|
59
59
|
files:
|
60
60
|
- .gitignore
|
61
|
-
- .
|
61
|
+
- .ruby-version
|
62
62
|
- .travis.yml
|
63
63
|
- LICENSE
|
64
64
|
- README.md
|
data/.rvmrc
DELETED