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.
- checksums.yaml +4 -4
- data/lib/smart_search_tag.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f60a9bffb75ceceade932e2331a8f14f1ff1b6ae
|
4
|
+
data.tar.gz: 6f24ec4a0817fd3a165a85d8f5fc37020cdd9c8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d9560a45cd4924650aad7b77b5c8d368b4f4bec1aac7d343ce4fdab8f9753ca216b1174858273a175911f81347235e18341771ca50e79748c5d2c40e70bc8ea
|
7
|
+
data.tar.gz: ab00b0d1a76232e7e755610ca4010b9bfa93d60aa568149a9302c623d19cc68b2b97818d58d6072827d64f7bbff3ec5143a335b3e44559fad4a982b2eecc6d9d
|
data/lib/smart_search_tag.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|