smart_search 0.0.8 → 0.0.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.
- checksums.yaml +4 -4
- data/lib/smart_search/{smart_search_engine.rb → engine.rb} +8 -6
- data/lib/smart_search.rb +1 -1
- data/lib/tasks/smart_search.rake +0 -38
- metadata +3 -4
- data/lib/smart_search_ignore_word.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c08e3ef5c746dc3f5b7c2f0a7d701f300959c3e2
|
4
|
+
data.tar.gz: 568bda297c771f7463564c08a45e9d0100394dd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14bf84d39e24dfe58175ff354bf2ddf5600e26ba60be773fcdaf7a88f796f11e3e5beb431b6cb65f943d62d2ced70438eadf3b981f62c6e3771a9e774a2593a5
|
7
|
+
data.tar.gz: 95941557d79b6979a41c5df85d675da72a09bb54036708a321a97b4e4c2b1b8558ae038db04b7455ced7456fdff86094b4d11bed5af9514a21e22361ba78a535
|
@@ -1,10 +1,12 @@
|
|
1
|
-
# :nodoc:
|
2
1
|
module SmartSearch
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
|
4
|
+
engine_name 'smart_search'
|
5
|
+
|
6
6
|
isolate_namespace SmartSearch
|
7
7
|
require "friendly_extensions"
|
8
8
|
require "amatch"
|
9
|
-
|
10
|
-
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
data/lib/smart_search.rb
CHANGED
data/lib/tasks/smart_search.rake
CHANGED
@@ -5,18 +5,6 @@ namespace :smart_search do
|
|
5
5
|
SmartSimilarity.load_from_query_history
|
6
6
|
end
|
7
7
|
|
8
|
-
desc "Load similarity data from file - Use FILE=path/to/file to specify file"
|
9
|
-
task :similarity_from_file => :environment do
|
10
|
-
require File.expand_path("../../smart_similarity", __FILE__)
|
11
|
-
if ENV['FILE_PATH'].nil?
|
12
|
-
raise ArgumentError, "No file specified. "
|
13
|
-
elsif !File.exist?(ENV['FILE_PATH'])
|
14
|
-
raise ArgumentError, "File not found "
|
15
|
-
else
|
16
|
-
SmartSimilarity.load_file(ENV['FILE_PATH'])
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
8
|
desc "Load similarity data from url - Use URL=http://.../ to specify url - Requires 'curl'"
|
21
9
|
task :similarity_from_url => :environment do
|
22
10
|
require File.expand_path("../../smart_similarity", __FILE__)
|
@@ -27,32 +15,6 @@ namespace :smart_search do
|
|
27
15
|
end
|
28
16
|
end
|
29
17
|
|
30
|
-
|
31
|
-
|
32
|
-
desc "load ignore words list"
|
33
|
-
task :load_ignore_words => :environment do
|
34
|
-
require File.expand_path("../../smart_search_ignore_word", __FILE__)
|
35
|
-
|
36
|
-
dic_path = File.expand_path("../../../dictionaries/*", __FILE__)
|
37
|
-
|
38
|
-
raise dic_path.inspect
|
39
|
-
|
40
|
-
dic_folders = Dir.glob(dic_path).select {|d| File.directory?(d)}
|
41
|
-
|
42
|
-
dic_folders.each do |folder|
|
43
|
-
locale = folder.split("/").last
|
44
|
-
word_file = File.join(folder, "#{locale}.ignore_words.dic")
|
45
|
-
if File.exists?(word_file)
|
46
|
-
File.open(word_file, "r").each_line do |word|
|
47
|
-
SmartSearchIgnoreWord.create(:word => word.strip.downcase, :locale => locale)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
18
|
end
|
57
19
|
|
58
20
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Eck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -77,9 +77,8 @@ files:
|
|
77
77
|
- config/database.yml
|
78
78
|
- config/routes.rb
|
79
79
|
- lib/smart_search.rb
|
80
|
-
- lib/smart_search/
|
80
|
+
- lib/smart_search/engine.rb
|
81
81
|
- lib/smart_search_history.rb
|
82
|
-
- lib/smart_search_ignore_word.rb
|
83
82
|
- lib/smart_search_tag.rb
|
84
83
|
- lib/smart_similarity.rb
|
85
84
|
- lib/tasks/smart_search.rake
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# The keep words out of the index, they can be added into this table
|
2
|
-
# TODO: Its not working yet
|
3
|
-
class SmartSearchIgnoreWord < ActiveRecord::Base
|
4
|
-
|
5
|
-
#= Configuration
|
6
|
-
self.table_name = "smart_search_ignore_words"
|
7
|
-
#== Associations
|
8
|
-
# => Stuff in Here
|
9
|
-
|
10
|
-
#== Plugins and modules
|
11
|
-
#=== PlugIns
|
12
|
-
# => Stuff in Here
|
13
|
-
|
14
|
-
#=== include Modules
|
15
|
-
# => Stuff in Here
|
16
|
-
|
17
|
-
#== Konstanten
|
18
|
-
# => Stuff in Here
|
19
|
-
|
20
|
-
#== Validation and Callbacks
|
21
|
-
#=== Validation
|
22
|
-
validates_uniqueness_of :word
|
23
|
-
|
24
|
-
#=== Callbacks
|
25
|
-
# => Stuff in Here
|
26
|
-
|
27
|
-
|
28
|
-
# => END
|
29
|
-
|
30
|
-
end
|