indexer101 0.2.2 → 0.3.0
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
- checksums.yaml.gz.sig +0 -0
- data/lib/indexer101.rb +24 -10
- data.tar.gz.sig +3 -3
- metadata +56 -36
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7c44c75f333aede7455b835b40bf64d518200bc5fb957050015b3a3b0b2ad7d9
         | 
| 4 | 
            +
              data.tar.gz: 1846323dc390c84218f75a7f0933636b0feefdf1ab80df4a3a093d34c2119cf4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a6f0276cf0a8ed7e547a19c3e230aa2b304652e561873db5ae085241d19015fb322678ae3115ae6f470a9a5a4129496216f45d6da73a361bbdfb1882ba689d26
         | 
| 7 | 
            +
              data.tar.gz: 87923aa4206e3a1de391ae6594fed0df2fc7c3b9dcc1295404e8c2a560ca9d03c418d01f90fc48dd1e771b3345476921acd5b34dab5586fbe8ed74e7ccc15877
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/lib/indexer101.rb
    CHANGED
    
    | @@ -127,12 +127,20 @@ class Indexer101 | |
| 127 127 | 
             
                threads = locations.flatten.map do |location|
         | 
| 128 128 |  | 
| 129 129 | 
             
                  Thread.new {
         | 
| 130 | 
            -
             | 
| 131 | 
            -
                     | 
| 132 | 
            -
             | 
| 133 | 
            -
                       | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 130 | 
            +
             | 
| 131 | 
            +
                    if location.is_a?(Dynarex) or location.is_a?(DxLite) then
         | 
| 132 | 
            +
                  
         | 
| 133 | 
            +
                      Thread.current[:v] = location
         | 
| 134 | 
            +
                  
         | 
| 135 | 
            +
                    elsif location.is_a? String
         | 
| 136 | 
            +
                  
         | 
| 137 | 
            +
                      case File.extname(location)
         | 
| 138 | 
            +
                      when '.xml'
         | 
| 139 | 
            +
                        Thread.current[:v] = Dynarex.new location, debug: @debug
         | 
| 140 | 
            +
                      when '.json'
         | 
| 141 | 
            +
                        Thread.current[:v] = DxLite.new location, debug: @debug
         | 
| 142 | 
            +
                      end
         | 
| 143 | 
            +
                  
         | 
| 136 144 | 
             
                    end
         | 
| 137 145 | 
             
                  }      
         | 
| 138 146 | 
             
                end
         | 
| @@ -140,7 +148,7 @@ class Indexer101 | |
| 140 148 | 
             
                ThreadsWait.all_waits(*threads)
         | 
| 141 149 |  | 
| 142 150 | 
             
                a = threads.map {|x| x[:v]}
         | 
| 143 | 
            -
             | 
| 151 | 
            +
                puts '_a: ' + a.inspect if @debug
         | 
| 144 152 | 
             
                t2 = Time.now - t
         | 
| 145 153 | 
             
                puts ("dxindex documents loaded in " + ("%.2f" % t2).brown \
         | 
| 146 154 | 
             
                      + " seconds").info
         | 
| @@ -152,6 +160,11 @@ class Indexer101 | |
| 152 160 |  | 
| 153 161 | 
             
                  id2 = id
         | 
| 154 162 |  | 
| 163 | 
            +
                  if @debug then
         | 
| 164 | 
            +
                    puts 'dx: ' + dx.class.inspect
         | 
| 165 | 
            +
                    puts 'dx.all: ' + dx.all.inspect
         | 
| 166 | 
            +
                  end
         | 
| 167 | 
            +
                  
         | 
| 155 168 | 
             
                  @indexer.uri_index.merge! Hash[dx.all.reverse.map.with_index \
         | 
| 156 169 | 
             
                    {|x,i| [id+i, [Time.parse(x.created), x.title, x.url]]}]
         | 
| 157 170 |  | 
| @@ -167,7 +180,8 @@ class Indexer101 | |
| 167 180 |  | 
| 168 181 | 
             
                    when 1
         | 
| 169 182 |  | 
| 170 | 
            -
                       | 
| 183 | 
            +
                      # \u{A3} = £ <- represented as Unicode to avoid ASCII to UTF-8 error
         | 
| 184 | 
            +
                      x.title.split(/[\s:"!\?\(\)\u{A3}]+(?=[\w#_'-]+)/).each do |keyword|
         | 
| 171 185 | 
             
                        @indexer.index[keyword.downcase.to_sym] ||= []
         | 
| 172 186 | 
             
                        @indexer.index[keyword.downcase.to_sym] << id2
         | 
| 173 187 | 
             
                      end
         | 
| @@ -214,7 +228,7 @@ class Indexer101 | |
| 214 228 |  | 
| 215 229 | 
             
              # enter the exact keywords to search from the index
         | 
| 216 230 | 
             
              #
         | 
| 217 | 
            -
              def search(*keywords)
         | 
| 231 | 
            +
              def search(*keywords, minchars: 3)
         | 
| 218 232 |  | 
| 219 233 | 
             
                t = Time.now
         | 
| 220 234 |  | 
| @@ -223,7 +237,7 @@ class Indexer101 | |
| 223 237 | 
             
                  a = []
         | 
| 224 238 | 
             
                  a += @indexer.index[x.to_sym].reverse if @indexer.index.has_key? x.to_sym
         | 
| 225 239 |  | 
| 226 | 
            -
                  if x.length  | 
| 240 | 
            +
                  if x.length >= minchars then
         | 
| 227 241 | 
             
                    a += @indexer.index.keys.grep(/^#{x}/i).flat_map\
         | 
| 228 242 | 
             
                        {|y| @indexer.index[y].reverse}
         | 
| 229 243 | 
             
                    a += @indexer.index.keys.grep(/#{x}/i).flat_map\
         | 
    
        data.tar.gz.sig
    CHANGED
    
    | @@ -1,3 +1,3 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 1 | 
            +
            8z�m�B	�D��0����嚶�0��r�5=����UC��Gߩ��cK�}g���ɂX�LOc���xG
         | 
| 2 | 
            +
            �!��'��y\�E��J��Q�x
         | 
| 3 | 
            +
            ��H��H���Y}��P=� ����q~N��
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: indexer101
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Robertson
         | 
| @@ -11,74 +11,94 @@ cert_chain: | |
| 11 11 | 
             
            - |
         | 
| 12 12 | 
             
              -----BEGIN CERTIFICATE-----
         | 
| 13 13 | 
             
              MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
         | 
| 14 | 
            -
               | 
| 15 | 
            -
               | 
| 16 | 
            -
               | 
| 17 | 
            -
               | 
| 18 | 
            -
               | 
| 19 | 
            -
               | 
| 20 | 
            -
               | 
| 21 | 
            -
               | 
| 22 | 
            -
               | 
| 23 | 
            -
               | 
| 24 | 
            -
               | 
| 25 | 
            -
               | 
| 26 | 
            -
               | 
| 14 | 
            +
              YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwMjIyMDAwNzQ2WhcN
         | 
| 15 | 
            +
              MjIwMjIyMDAwNzQ2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
         | 
| 16 | 
            +
              cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDqAwJO
         | 
| 17 | 
            +
              ET6LAnOZB9q04zgLVFB0gJTcuLvfwjf7vpH9gCa5uqshSJnfi0owkeS2Hao0OwD+
         | 
| 18 | 
            +
              vJrRRYbPfmXHAhEV8l9bSE6Ul1uTT9A+XS7g724sgOm5tCKFkLu+rcDy25MSjqpD
         | 
| 19 | 
            +
              q+cPG4SN3ZUGK5eR9tp//dzdrjCV2wsOaoYKPajVY698p+sRf1zsHsSMxYnJPD/8
         | 
| 20 | 
            +
              IkeNC+3VdsJFQ7wAoSk4hSpDuIi1xknA61/elDy5O07r1M25PJMntBE6QpJZblvw
         | 
| 21 | 
            +
              v5u8U7+nK9P82KFfUwAjqkrhizt90M+0eK6dG44PnqafnxF84K2v7Qr1W6hKMIeL
         | 
| 22 | 
            +
              DcqKPjAop+DO8WPCtfKFcFQKGRSe+H2rej3h34eGPH/GVoh8/h+ZuoDUfQRfoWLb
         | 
| 23 | 
            +
              zUTM4uC1XwMlRjg8W4uYgV8SWZ5eii3tpmUz7moKQ4k9DSNNpGO+/bk/IcMVbRkb
         | 
| 24 | 
            +
              xG/LzBAa6JQyAtVw9AMq8WHZKtJeNrdthoJSczsurthCHb0nY7VUQ/pp9JsCAwEA
         | 
| 25 | 
            +
              AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUVn1uBRaL
         | 
| 26 | 
            +
              Zh8+3WB077Lz84bokZowJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
         | 
| 27 27 | 
             
              c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
         | 
| 28 | 
            -
               | 
| 29 | 
            -
               | 
| 30 | 
            -
               | 
| 31 | 
            -
               | 
| 32 | 
            -
               | 
| 33 | 
            -
               | 
| 34 | 
            -
               | 
| 35 | 
            -
               | 
| 36 | 
            -
               | 
| 28 | 
            +
              BgkqhkiG9w0BAQsFAAOCAYEAUzwCxgrA0YiJvXoi1ZHlhhz+ROzRn6XSQZZVd0Ym
         | 
| 29 | 
            +
              gQVkUcvb/iiMnE0PZdivLiorRjhdR5tIPAYhmuN7Mr5IscQFdb1cndyC+qUzy6zP
         | 
| 30 | 
            +
              HJGDGqqHDtiYpWlQ3/VAD4V+mAYj67CTj8gM2Y0OfjOIzKLf4jeLzcR0XjxCS9bH
         | 
| 31 | 
            +
              g3cF/0FdJ5ydwo6r9QW/mE5yej6yuWBD9NFjWVbV/TAY3rWWDtw9g1WG31HjZVRB
         | 
| 32 | 
            +
              lYndPAx0WIUBse5IRDGTiQ1JuMI5vBrxYJCb1Je506nR2rktACDRVSe/DTM4sxZn
         | 
| 33 | 
            +
              oP3LBd1hPOAhNya8tD4FmUjQg4tvuWwIKh55XorZVEkzTWGgAJSnu7XTxtPcjxFA
         | 
| 34 | 
            +
              U/3nmRr1BTYMN96T+3L81oqJTW5CxAAlsR97O7H8eZhwnNdG9HjgAk4PwiMLOhPb
         | 
| 35 | 
            +
              Ely2/UitUG79uLcra+83gWVYzYiqBYC2d5HR4vCpTeecqYFXjWo9E3LMrvyB5Unk
         | 
| 36 | 
            +
              zn10wjI+T1ysW7U6t+VJft8s
         | 
| 37 37 | 
             
              -----END CERTIFICATE-----
         | 
| 38 | 
            -
            date:  | 
| 38 | 
            +
            date: 2022-01-25 00:00:00.000000000 Z
         | 
| 39 39 | 
             
            dependencies:
         | 
| 40 40 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 41 41 | 
             
              name: dynarex
         | 
| 42 42 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 43 43 | 
             
                requirements:
         | 
| 44 | 
            -
                - - "~>"
         | 
| 45 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            -
                    version: '1.8'
         | 
| 47 44 | 
             
                - - ">="
         | 
| 48 45 | 
             
                  - !ruby/object:Gem::Version
         | 
| 49 | 
            -
                    version: 1. | 
| 46 | 
            +
                    version: 1.9.0
         | 
| 47 | 
            +
                - - "~>"
         | 
| 48 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 49 | 
            +
                    version: '1.9'
         | 
| 50 50 | 
             
              type: :runtime
         | 
| 51 51 | 
             
              prerelease: false
         | 
| 52 52 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 53 53 | 
             
                requirements:
         | 
| 54 | 
            -
                - - "~>"
         | 
| 55 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 56 | 
            -
                    version: '1.8'
         | 
| 57 54 | 
             
                - - ">="
         | 
| 58 55 | 
             
                  - !ruby/object:Gem::Version
         | 
| 59 | 
            -
                    version: 1. | 
| 56 | 
            +
                    version: 1.9.0
         | 
| 57 | 
            +
                - - "~>"
         | 
| 58 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 59 | 
            +
                    version: '1.9'
         | 
| 60 60 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 61 61 | 
             
              name: dxlite
         | 
| 62 62 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 63 63 | 
             
                requirements:
         | 
| 64 64 | 
             
                - - "~>"
         | 
| 65 65 | 
             
                  - !ruby/object:Gem::Version
         | 
| 66 | 
            -
                    version: '0. | 
| 66 | 
            +
                    version: '0.4'
         | 
| 67 67 | 
             
                - - ">="
         | 
| 68 68 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            -
                    version: 0. | 
| 69 | 
            +
                    version: 0.4.1
         | 
| 70 70 | 
             
              type: :runtime
         | 
| 71 71 | 
             
              prerelease: false
         | 
| 72 72 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 73 | 
             
                requirements:
         | 
| 74 | 
            +
                - - "~>"
         | 
| 75 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 76 | 
            +
                    version: '0.4'
         | 
| 77 | 
            +
                - - ">="
         | 
| 78 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 79 | 
            +
                    version: 0.4.1
         | 
| 80 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 81 | 
            +
              name: thwait
         | 
| 82 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 83 | 
            +
                requirements:
         | 
| 84 | 
            +
                - - ">="
         | 
| 85 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 86 | 
            +
                    version: 0.2.0
         | 
| 74 87 | 
             
                - - "~>"
         | 
| 75 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 76 89 | 
             
                    version: '0.2'
         | 
| 90 | 
            +
              type: :runtime
         | 
| 91 | 
            +
              prerelease: false
         | 
| 92 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 | 
            +
                requirements:
         | 
| 77 94 | 
             
                - - ">="
         | 
| 78 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 79 | 
            -
                    version: 0.2. | 
| 96 | 
            +
                    version: 0.2.0
         | 
| 97 | 
            +
                - - "~>"
         | 
| 98 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 99 | 
            +
                    version: '0.2'
         | 
| 80 100 | 
             
            description: 
         | 
| 81 | 
            -
            email:  | 
| 101 | 
            +
            email: digital.robertson@gmail.com
         | 
| 82 102 | 
             
            executables: []
         | 
| 83 103 | 
             
            extensions: []
         | 
| 84 104 | 
             
            extra_rdoc_files: []
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |