smart_search 0.0.67 → 0.0.68

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smart_search_tag.rb +13 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea2edfd305ac9960e74f36148bc8710e0b877416
4
- data.tar.gz: 0d7d5bd0c94c3624d11d83fded3abcd6cb1a42a3
3
+ metadata.gz: f60a9bffb75ceceade932e2331a8f14f1ff1b6ae
4
+ data.tar.gz: 6f24ec4a0817fd3a165a85d8f5fc37020cdd9c8d
5
5
  SHA512:
6
- metadata.gz: 2b5192daa702b12f37fbd75dda8a077815ffd63974e9f8fd0c4a95c29adfa35f942e413c677f7c9d6e631c20cc5e617716b1267c3d5a06fde21c1dcc37cfc9e9
7
- data.tar.gz: 94667a98ba392b0e0dafe5339f425e27cc4d0d5fbbd75450e815a0271a25a700e6c3c9d282b896bf49033bad72d34c0bb3053c9729ab0e8adf7782caeb5001a1
6
+ metadata.gz: 0d9560a45cd4924650aad7b77b5c8d368b4f4bec1aac7d343ce4fdab8f9753ca216b1174858273a175911f81347235e18341771ca50e79748c5d2c40e70bc8ea
7
+ data.tar.gz: ab00b0d1a76232e7e755610ca4010b9bfa93d60aa568149a9302c623d19cc68b2b97818d58d6072827d64f7bbff3ec5143a335b3e44559fad4a982b2eecc6d9d
@@ -1,3 +1,16 @@
1
1
  # Represents the search index
2
2
  class SmartSearchTag < ActiveRecord::Base
3
+
4
+
5
+ # Get a list of available search tags
6
+ def self.tags_list(query, table= nil)
7
+ if query.size < 3
8
+ return []
9
+ else
10
+ list = sql_query!("select search_tags from #{self.table_name} where search_tags like '%#{query}%' #{"and table_name = '#{table}'" if table} ").map {|r| r['search_tags']}
11
+ list = list.join(" ").clear_html.split(" ").uniq
12
+ return list.sort.grep(Regexp.new(query))
13
+ end
14
+ end
15
+
3
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.67
4
+ version: 0.0.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Eck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-26 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails