mincer 0.2.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf19d30ce22fd1d2c9b5dfa5749e8ff51f44280d
4
- data.tar.gz: 9166a7ac4cef59a1f9e36b7cac62d2e43f54377c
3
+ metadata.gz: 0d97a97f1c5f14b8411b406709621b4fe9f2c14b
4
+ data.tar.gz: bf7f943474b0fc73e112bb5d78ce0edf5f018dea
5
5
  SHA512:
6
- metadata.gz: a74f5881b83baad2562fb960974613add4640322d91eef697b0e6352ce19c30db0b2675e16ddc185465effb76547c635c221dfeb3b56afd4106d491ef670ae93
7
- data.tar.gz: 82f174b5bab58f7ef3488d8767338f340f6c36fa9a6036c53148fda8f00ce1d0d9fa87e28bc7de0507b42009342b503511d3bb0b710a9674ebeaa0213d3638b4
6
+ metadata.gz: d01b5f077f72bb1e9b70b7f88bbe64a5afb92409d476a04a8200f15d02e95491cd4a0c6db067266d95c3beb377488fb58be3a77f34fdc47d80933c750f1238d0
7
+ data.tar.gz: 9bd281ba05fcd19e8f8ff96eb2da31eba134a9e163c925431e5b43f3564ad59aaaa567c882db7cb6128659fac58c1c12e666d267b058f4c1b67265854cf4267c
@@ -19,7 +19,7 @@ module Mincer
19
19
 
20
20
  def apply_pg_search(relation, args)
21
21
  rel = relation.where(conditions(args))
22
- rank = rank(args) ? rel.reorder(rank) : rel
22
+ (rank = rank(args)) ? rel.reorder(rank) : rel
23
23
  end
24
24
 
25
25
  def conditions(args)
@@ -1,7 +1,7 @@
1
1
  module Mincer
2
2
 
3
3
  def self.version
4
- Gem::Version.new '0.2.1'
4
+ Gem::Version.new '0.2.2'
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
@@ -31,6 +31,12 @@ describe ::Mincer::Processors::PgSearch::Processor do
31
31
  query.to_a.count.should eq(1)
32
32
  end
33
33
 
34
+ it 'order by rank' do
35
+ query = subject.new(ActiveRecordModel, { 'pattern' => 'Bingo' })
36
+ query.to_sql.should include("(ts_rank((to_tsvector('simple', unaccent(coalesce(active_record_models.text, '')))), (to_tsquery('simple', unaccent('Bingo')))))")
37
+ query.to_a.count.should eq(1)
38
+ end
39
+
34
40
  it 'avoids search when pattern is an empty string or spaces' do
35
41
  query = subject.new(ActiveRecordModel, { 'pattern' => ' ' })
36
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mincer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Krasinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-15 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord