smart_search 0.0.81 → 0.0.91
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.rb +6 -2
- data/lib/smart_search/{smart_search_engine.rb → engine.rb} +8 -6
- 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: 3b57cb82919d2ca20035a53bc79b48a9e39f173d
         | 
| 4 | 
            +
              data.tar.gz: bbfe700ed2abdfcfcc126ce9378624c5608f8cb5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d21748d7e69a23a1a3ae4f51111cf7fbb3213a0259c712aec37e655e9a58ff0060f423997ccfa03a20338d25883eff3663c1fd370b22fe0bc09eb7bc8199ce41
         | 
| 7 | 
            +
              data.tar.gz: ab1731b0fc64b2bcd9d824df4260c993882a1ec7b2c7482c64930f1d876f26ae458d74b31048949ab91e6cb03d8755c379777607ecab7c627ab26558f54e5f19
         | 
    
        data/lib/smart_search.rb
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            require "rails"
         | 
| 3 3 |  | 
| 4 4 | 
             
            require "smart_search"
         | 
| 5 | 
            -
            require "smart_search/ | 
| 5 | 
            +
            require "smart_search/engine"
         | 
| 6 6 |  | 
| 7 7 | 
             
            require "smart_similarity"
         | 
| 8 8 | 
             
            require "smart_search_history"
         | 
| @@ -221,7 +221,11 @@ module SmartSearch | |
| 221 221 |  | 
| 222 222 | 
             
                  @merged_tags.values.each do |t|
         | 
| 223 223 | 
             
                    if !t[:search_tags].blank? && t[:search_tags].size > 1
         | 
| 224 | 
            -
                       | 
| 224 | 
            +
                      begin
         | 
| 225 | 
            +
                        SmartSearchTag.create(t.merge!(:table_name => self.class.table_name, :entry_id => self.id, :search_tags => t[:search_tags].strip.split(" ").uniq.join(" ")))
         | 
| 226 | 
            +
                      rescue Mysql2::Error => e
         | 
| 227 | 
            +
                        
         | 
| 228 | 
            +
                      end
         | 
| 225 229 | 
             
                    end
         | 
| 226 230 | 
             
                  end
         | 
| 227 231 |  | 
| @@ -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/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.91
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Florian Eck
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2018-01-16 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  
         |