ts_vector_tags 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ts_vector_tags.rb +2 -2
- data/ts_vector_tags.gemspec +1 -1
- metadata +4 -4
data/lib/ts_vector_tags.rb
CHANGED
@@ -28,14 +28,14 @@ module TsVectorTags
|
|
28
28
|
base.class_eval do
|
29
29
|
# Accepts a comma separated list of tags and applies the 'and'-operator to them
|
30
30
|
scope :with_tags, lambda { |tags|
|
31
|
-
where("tags_vector @@
|
31
|
+
where("tags_vector @@ ?::tsquery ", TsVectorTags::Standardizer.tagify(tags).join(' & '))
|
32
32
|
}
|
33
33
|
|
34
34
|
# Accepts a proper ts_query an allows complex logical expressions like "foo & !(bar | bling)"
|
35
35
|
scope :with_tags_query, lambda { |query|
|
36
36
|
raise InvalidTsQueryError, "Invalid tag query '#{query}'" unless TsVectorTags.acceptable_tsquery?(query)
|
37
37
|
# "!foo" will not match empty tsvectors, so we have to cheat using coalesce :-(
|
38
|
-
where("coalesce(tags_vector, '-invalid-tag-') @@
|
38
|
+
where("coalesce(tags_vector, '-invalid-tag-') @@ '#{query}'::tsquery")
|
39
39
|
}
|
40
40
|
|
41
41
|
# Make sure empty vectors are always saved as null values
|
data/ts_vector_tags.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ts_vector_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -75,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
segments:
|
77
77
|
- 0
|
78
|
-
hash:
|
78
|
+
hash: 2492043440947131244
|
79
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
80
|
none: false
|
81
81
|
requirements:
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
segments:
|
86
86
|
- 0
|
87
|
-
hash:
|
87
|
+
hash: 2492043440947131244
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project: ts_vector_tags
|
90
90
|
rubygems_version: 1.8.24
|