picky 4.0.5 → 4.0.6
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.
- data/lib/picky/query/token.rb +6 -0
- data/spec/functional/only_spec.rb +31 -21
- metadata +17 -17
    
        data/lib/picky/query/token.rb
    CHANGED
    
    | @@ -154,6 +154,12 @@ module Picky | |
| 154 154 | 
             
                    else
         | 
| 155 155 | 
             
                      [@qualifiers.split(@@split_qualifiers), @text]
         | 
| 156 156 | 
             
                    end
         | 
| 157 | 
            +
                    # if @text.blank?
         | 
| 158 | 
            +
                    #   @qualifiers = nil
         | 
| 159 | 
            +
                    #   @text = @qualifiers || EMPTY_STRING
         | 
| 160 | 
            +
                    # else
         | 
| 161 | 
            +
                    #   @qualifiers = @qualifiers.split @@split_qualifiers
         | 
| 162 | 
            +
                    # end
         | 
| 157 163 | 
             
                  end
         | 
| 158 164 |  | 
| 159 165 | 
             
                  # Internally, qualifiers are nil if there are none.
         | 
| @@ -6,12 +6,12 @@ describe 'Search#only' do | |
| 6 6 |  | 
| 7 7 | 
             
              it 'offers the option only' do
         | 
| 8 8 | 
             
                index = Picky::Index.new :only do
         | 
| 9 | 
            -
                  category : | 
| 10 | 
            -
                  category : | 
| 11 | 
            -
                  category : | 
| 9 | 
            +
                  category :category1
         | 
| 10 | 
            +
                  category :category2
         | 
| 11 | 
            +
                  category :category3
         | 
| 12 12 | 
             
                end
         | 
| 13 13 |  | 
| 14 | 
            -
                index.add Struct.new(:id, : | 
| 14 | 
            +
                index.add Struct.new(:id, :category1, :category2, :category3).new(1, 'text1', 'text2', 'text3')
         | 
| 15 15 |  | 
| 16 16 | 
             
                try = Picky::Search.new index
         | 
| 17 17 | 
             
                try.search('text1').ids.should == [1]
         | 
| @@ -19,34 +19,44 @@ describe 'Search#only' do | |
| 19 19 | 
             
                try.search('text3').ids.should == [1]
         | 
| 20 20 |  | 
| 21 21 | 
             
                try_again = Picky::Search.new index do
         | 
| 22 | 
            -
                  only : | 
| 22 | 
            +
                  only :category1
         | 
| 23 23 | 
             
                end
         | 
| 24 24 | 
             
                try_again.search('text1').ids.should == [1]
         | 
| 25 25 | 
             
                try_again.search('text2').ids.should == []
         | 
| 26 26 | 
             
                try_again.search('text3').ids.should == []
         | 
| 27 27 |  | 
| 28 | 
            -
                try_again.only : | 
| 28 | 
            +
                try_again.only :category2, :category3
         | 
| 29 | 
            +
                
         | 
| 29 30 | 
             
                try_again.search('text1').ids.should == []
         | 
| 30 31 | 
             
                try_again.search('text2').ids.should == [1]
         | 
| 31 32 | 
             
                try_again.search('text3').ids.should == [1]
         | 
| 32 33 |  | 
| 33 | 
            -
                try_again.search(' | 
| 34 | 
            -
                try_again.search(' | 
| 35 | 
            -
                try_again.search(' | 
| 34 | 
            +
                try_again.search('category1:text1').ids.should == []
         | 
| 35 | 
            +
                try_again.search('category1:text2').ids.should == []
         | 
| 36 | 
            +
                try_again.search('category1:text3').ids.should == []
         | 
| 37 | 
            +
                
         | 
| 38 | 
            +
                try_again.search('category2:text1').ids.should == []
         | 
| 39 | 
            +
                try_again.search('category2:text2').ids.should == [1]
         | 
| 40 | 
            +
                try_again.search('category2:text3').ids.should == []
         | 
| 41 | 
            +
                
         | 
| 42 | 
            +
                try_again.search('category3:text1').ids.should == []
         | 
| 43 | 
            +
                try_again.search('category3:text2').ids.should == []
         | 
| 44 | 
            +
                try_again.search('category3:text3').ids.should == [1]
         | 
| 45 | 
            +
                
         | 
| 46 | 
            +
                try_again.search('category1,category2:text1').ids.should == []
         | 
| 47 | 
            +
                try_again.search('category1,category2:text2').ids.should == [1]
         | 
| 48 | 
            +
                try_again.search('category1,category2:text3').ids.should == []
         | 
| 36 49 |  | 
| 37 | 
            -
                try_again.search(' | 
| 38 | 
            -
                try_again.search(' | 
| 39 | 
            -
                try_again.search(' | 
| 40 | 
            -
                try_again.search('text2,text3:text1').ids.should == []
         | 
| 50 | 
            +
                try_again.search('category1,category3:text1').ids.should == []
         | 
| 51 | 
            +
                try_again.search('category1,category3:text2').ids.should == []
         | 
| 52 | 
            +
                try_again.search('category1,category3:text3').ids.should == [1]
         | 
| 41 53 |  | 
| 42 | 
            -
                try_again.search(' | 
| 43 | 
            -
                try_again.search(' | 
| 44 | 
            -
                try_again.search(' | 
| 45 | 
            -
                try_again.search('text2,text3:text2').ids.should == [1]
         | 
| 54 | 
            +
                try_again.search('category2,category3:text1').ids.should == []
         | 
| 55 | 
            +
                try_again.search('category2,category3:text2').ids.should == [1]
         | 
| 56 | 
            +
                try_again.search('category2,category3:text3').ids.should == [1]
         | 
| 46 57 |  | 
| 47 | 
            -
                try_again.search(' | 
| 48 | 
            -
                try_again.search(' | 
| 49 | 
            -
                try_again.search(' | 
| 50 | 
            -
                try_again.search('text2,text3:text3').ids.should == [1]
         | 
| 58 | 
            +
                try_again.search('category1,category2,category3:text1').ids.should == []
         | 
| 59 | 
            +
                try_again.search('category1,category2,category3:text2').ids.should == [1]
         | 
| 60 | 
            +
                try_again.search('category1,category2,category3:text3').ids.should == [1]
         | 
| 51 61 | 
             
              end
         | 
| 52 62 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: picky
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4.0. | 
| 4 | 
            +
              version: 4.0.6
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,11 +9,11 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2012-01-02 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rspec
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &70313201158420 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ! '>='
         | 
| @@ -21,21 +21,21 @@ dependencies: | |
| 21 21 | 
             
                    version: '0'
         | 
| 22 22 | 
             
              type: :development
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *70313201158420
         | 
| 25 25 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 26 26 | 
             
              name: picky-client
         | 
| 27 | 
            -
              requirement: & | 
| 27 | 
            +
              requirement: &70313201157320 !ruby/object:Gem::Requirement
         | 
| 28 28 | 
             
                none: false
         | 
| 29 29 | 
             
                requirements:
         | 
| 30 30 | 
             
                - - ~>
         | 
| 31 31 | 
             
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            -
                    version: 4.0. | 
| 32 | 
            +
                    version: 4.0.6
         | 
| 33 33 | 
             
              type: :development
         | 
| 34 34 | 
             
              prerelease: false
         | 
| 35 | 
            -
              version_requirements: * | 
| 35 | 
            +
              version_requirements: *70313201157320
         | 
| 36 36 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 37 37 | 
             
              name: text
         | 
| 38 | 
            -
              requirement: & | 
| 38 | 
            +
              requirement: &70313201154620 !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                none: false
         | 
| 40 40 | 
             
                requirements:
         | 
| 41 41 | 
             
                - - ! '>='
         | 
| @@ -43,10 +43,10 @@ dependencies: | |
| 43 43 | 
             
                    version: '0'
         | 
| 44 44 | 
             
              type: :runtime
         | 
| 45 45 | 
             
              prerelease: false
         | 
| 46 | 
            -
              version_requirements: * | 
| 46 | 
            +
              version_requirements: *70313201154620
         | 
| 47 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 48 | 
             
              name: yajl-ruby
         | 
| 49 | 
            -
              requirement: & | 
| 49 | 
            +
              requirement: &70313201153540 !ruby/object:Gem::Requirement
         | 
| 50 50 | 
             
                none: false
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - ! '>='
         | 
| @@ -54,10 +54,10 @@ dependencies: | |
| 54 54 | 
             
                    version: '0'
         | 
| 55 55 | 
             
              type: :runtime
         | 
| 56 56 | 
             
              prerelease: false
         | 
| 57 | 
            -
              version_requirements: * | 
| 57 | 
            +
              version_requirements: *70313201153540
         | 
| 58 58 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 59 59 | 
             
              name: activesupport
         | 
| 60 | 
            -
              requirement: & | 
| 60 | 
            +
              requirement: &70313201152460 !ruby/object:Gem::Requirement
         | 
| 61 61 | 
             
                none: false
         | 
| 62 62 | 
             
                requirements:
         | 
| 63 63 | 
             
                - - ~>
         | 
| @@ -65,10 +65,10 @@ dependencies: | |
| 65 65 | 
             
                    version: '3.0'
         | 
| 66 66 | 
             
              type: :runtime
         | 
| 67 67 | 
             
              prerelease: false
         | 
| 68 | 
            -
              version_requirements: * | 
| 68 | 
            +
              version_requirements: *70313201152460
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: procrastinate
         | 
| 71 | 
            -
              requirement: & | 
| 71 | 
            +
              requirement: &70313201151140 !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                none: false
         | 
| 73 73 | 
             
                requirements:
         | 
| 74 74 | 
             
                - - ~>
         | 
| @@ -76,10 +76,10 @@ dependencies: | |
| 76 76 | 
             
                    version: '0.4'
         | 
| 77 77 | 
             
              type: :runtime
         | 
| 78 78 | 
             
              prerelease: false
         | 
| 79 | 
            -
              version_requirements: * | 
| 79 | 
            +
              version_requirements: *70313201151140
         | 
| 80 80 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 81 81 | 
             
              name: rack_fast_escape
         | 
| 82 | 
            -
              requirement: & | 
| 82 | 
            +
              requirement: &70313201150480 !ruby/object:Gem::Requirement
         | 
| 83 83 | 
             
                none: false
         | 
| 84 84 | 
             
                requirements:
         | 
| 85 85 | 
             
                - - ! '>='
         | 
| @@ -87,7 +87,7 @@ dependencies: | |
| 87 87 | 
             
                    version: '0'
         | 
| 88 88 | 
             
              type: :runtime
         | 
| 89 89 | 
             
              prerelease: false
         | 
| 90 | 
            -
              version_requirements: * | 
| 90 | 
            +
              version_requirements: *70313201150480
         | 
| 91 91 | 
             
            description: Fast Ruby semantic text search engine with comfortable single field interface.
         | 
| 92 92 | 
             
            email: florian.hanke+picky@gmail.com
         | 
| 93 93 | 
             
            executables:
         |