ts-xml 1.0.2 → 1.0.3
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/README.textile +7 -1
- data/TODO +15 -0
- data/lib/thinking_sphinx/xml.rb +2 -0
- data/lib/thinking_sphinx/xml/adapters/oracle_adapter.rb +1 -1
- data/lib/thinking_sphinx/xml/adapters/sqlite3_adapter.rb +1 -1
- data/lib/thinking_sphinx/xml/source.rb +10 -0
- data/lib/thinking_sphinx/xml/tasks.rb +1 -2
- metadata +9 -7
- data/spec/cucumber_env.rb +0 -22
    
        data/README.textile
    CHANGED
    
    | @@ -15,16 +15,22 @@ In your @environment.rb@ file, with the rest of your gem dependencies: | |
| 15 15 | 
             
            And add the following lines to the bottom of your @Rakefile@:
         | 
| 16 16 |  | 
| 17 17 | 
             
            <pre><code>begin
         | 
| 18 | 
            +
              require 'thinking_sphinx'
         | 
| 18 19 | 
             
              require 'thinking_sphinx/tasks'
         | 
| 20 | 
            +
              require 'thinking_sphinx/xml'
         | 
| 19 21 | 
             
              require 'thinking_sphinx/xml/tasks'
         | 
| 20 22 | 
             
            rescue LoadError
         | 
| 21 | 
            -
              puts  | 
| 23 | 
            +
              puts 'Cannot load thinking sphinx tasks'
         | 
| 22 24 | 
             
            end</code></pre>
         | 
| 23 25 |  | 
| 24 26 | 
             
            h2. Usage
         | 
| 25 27 |  | 
| 26 28 | 
             
            Just add those lines and it will use xmlpipe2 data source instead of SQL data source.
         | 
| 27 29 |  | 
| 30 | 
            +
            h2. Limitations
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            Oracle CLOB data types are not supported and indexed fields are trimmed to 4000 bytes.
         | 
| 33 | 
            +
             | 
| 28 34 | 
             
            h2. Copyright
         | 
| 29 35 |  | 
| 30 36 | 
             
            Copyright (c) 2010 Edgars Beigarts, and released under an MIT Licence.
         | 
    
        data/TODO
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            = TODO
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Fix tag_ids
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            = Oracle vs ts-xml
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ts-xml:
         | 
| 8 | 
            +
            - pagaidām neatbalsta clob
         | 
| 9 | 
            +
            - 4000 baitu limits uz laukiem
         | 
| 10 | 
            +
            + var meklēt caur daudziem indeksiem
         | 
| 11 | 
            +
            + var indeksēt dajebko caur xml
         | 
| 12 | 
            +
            + var viegli nomapot Ā uz A utt
         | 
| 13 | 
            +
            + morphology, stemming
         | 
| 14 | 
            +
            + facets
         | 
| 15 | 
            +
            + 
         | 
    
        data/lib/thinking_sphinx/xml.rb
    CHANGED
    
    
| @@ -14,7 +14,7 @@ module ThinkingSphinx | |
| 14 14 | 
             
                end
         | 
| 15 15 |  | 
| 16 16 | 
             
                def group_concatenate(clause, separator = ' ')
         | 
| 17 | 
            -
                  "TO_STRING(CAST(COLLECT(TO_CHAR(#{clause})) AS SYS.ODCIVARCHAR2LIST), '#{separator}')"
         | 
| 17 | 
            +
                  "TO_STRING(CAST(COLLECT(DISTINCT TO_CHAR(#{clause})) AS SYS.ODCIVARCHAR2LIST), '#{separator}')"
         | 
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 | 
             
                def cast_to_string(clause)
         | 
| @@ -1,5 +1,15 @@ | |
| 1 1 | 
             
            module ThinkingSphinx
         | 
| 2 2 | 
             
              class Source
         | 
| 3 | 
            +
                def initialize_with_oracle_database_configuration(index, options = {})
         | 
| 4 | 
            +
                  connection = index.model.connection
         | 
| 5 | 
            +
                  if connection.class.name == "ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter"
         | 
| 6 | 
            +
                    connection.instance_variable_set(:@config, connection.raw_connection.instance_variable_get(:@config))
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
                  initialize_without_oracle_database_configuration(index, options)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
                
         | 
| 11 | 
            +
                alias_method_chain :initialize, :oracle_database_configuration
         | 
| 12 | 
            +
                
         | 
| 3 13 | 
             
                def to_riddle_for_core(offset, position)
         | 
| 4 14 | 
             
                  source = Riddle::Configuration::XMLSource.new(
         | 
| 5 15 | 
             
                    "#{index.core_name}_#{position}", "xmlpipe2"
         | 
| @@ -11,7 +11,6 @@ namespace :thinking_sphinx do | |
| 11 11 | 
             
                ensure
         | 
| 12 12 | 
             
                  STDOUT.reopen(_stdout)
         | 
| 13 13 | 
             
                end
         | 
| 14 | 
            -
                require 'thinking_sphinx'
         | 
| 15 14 | 
             
                require 'thinking_sphinx/xml'
         | 
| 16 15 | 
             
                # ThinkingSphinx::Configuration.instance.load_models
         | 
| 17 16 | 
             
                source_name = ENV["NAME"]
         | 
| @@ -56,7 +55,7 @@ namespace :thinking_sphinx do | |
| 56 55 | 
             
                    # STDERR.puts attribute
         | 
| 57 56 | 
             
                    case attribute && attribute.type
         | 
| 58 57 | 
             
                    when :boolean
         | 
| 59 | 
            -
                      v = ['Y', 'T', '1', 1, true].include?(v) ? 1 : 0
         | 
| 58 | 
            +
                      v = ['Y', 'T', 't', '1', 1, true].include?(v) ? 1 : 0
         | 
| 60 59 | 
             
                    when :integer, :datetime
         | 
| 61 60 | 
             
                      v = v.to_i
         | 
| 62 61 | 
             
                    when :float
         | 
    
        metadata
    CHANGED
    
    | @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              segments: 
         | 
| 6 6 | 
             
              - 1
         | 
| 7 7 | 
             
              - 0
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 1.0. | 
| 8 | 
            +
              - 3
         | 
| 9 | 
            +
              version: 1.0.3
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - Edgars Beigarts
         | 
| @@ -14,7 +14,7 @@ autorequire: | |
| 14 14 | 
             
            bindir: bin
         | 
| 15 15 | 
             
            cert_chain: []
         | 
| 16 16 |  | 
| 17 | 
            -
            date: 2010- | 
| 17 | 
            +
            date: 2010-03-18 00:00:00 +02:00
         | 
| 18 18 | 
             
            default_executable: 
         | 
| 19 19 | 
             
            dependencies: 
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -69,7 +69,7 @@ dependencies: | |
| 69 69 | 
             
                    version: "0"
         | 
| 70 70 | 
             
              type: :development
         | 
| 71 71 | 
             
              version_requirements: *id004
         | 
| 72 | 
            -
            description:  | 
| 72 | 
            +
            description: Thinking Sphinx plugin for xmlpipe2 data sources (Oracle, SQLite3, ...)
         | 
| 73 73 | 
             
            email: 1@wb4.lv
         | 
| 74 74 | 
             
            executables: []
         | 
| 75 75 |  | 
| @@ -78,6 +78,7 @@ extensions: [] | |
| 78 78 | 
             
            extra_rdoc_files: 
         | 
| 79 79 | 
             
            - LICENSE
         | 
| 80 80 | 
             
            - README.textile
         | 
| 81 | 
            +
            - TODO
         | 
| 81 82 | 
             
            files: 
         | 
| 82 83 | 
             
            - LICENSE
         | 
| 83 84 | 
             
            - README.textile
         | 
| @@ -87,6 +88,7 @@ files: | |
| 87 88 | 
             
            - lib/thinking_sphinx/xml/adapters/sqlite3_adapter.rb
         | 
| 88 89 | 
             
            - lib/thinking_sphinx/xml/source.rb
         | 
| 89 90 | 
             
            - lib/thinking_sphinx/xml/tasks.rb
         | 
| 91 | 
            +
            - TODO
         | 
| 90 92 | 
             
            has_rdoc: true
         | 
| 91 93 | 
             
            homepage: http://github.com/ebeigarts/ts-xml
         | 
| 92 94 | 
             
            licenses: []
         | 
| @@ -116,6 +118,6 @@ rubyforge_project: | |
| 116 118 | 
             
            rubygems_version: 1.3.6
         | 
| 117 119 | 
             
            signing_key: 
         | 
| 118 120 | 
             
            specification_version: 3
         | 
| 119 | 
            -
            summary: Thinking Sphinx  | 
| 120 | 
            -
            test_files: 
         | 
| 121 | 
            -
             | 
| 121 | 
            +
            summary: Thinking Sphinx + XML
         | 
| 122 | 
            +
            test_files: []
         | 
| 123 | 
            +
             | 
    
        data/spec/cucumber_env.rb
    DELETED
    
    | @@ -1,22 +0,0 @@ | |
| 1 | 
            -
            require 'rubygems'
         | 
| 2 | 
            -
            require 'cucumber'
         | 
| 3 | 
            -
            require 'spec'
         | 
| 4 | 
            -
            require 'fileutils'
         | 
| 5 | 
            -
            require 'ginger'
         | 
| 6 | 
            -
            require 'will_paginate'
         | 
| 7 | 
            -
            require 'active_record'
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            $:.unshift File.dirname(__FILE__) + '/../../lib'
         | 
| 10 | 
            -
            Dir[File.join(File.dirname(__FILE__), '../../vendor/*/lib')].each do |path|
         | 
| 11 | 
            -
              $:.unshift path
         | 
| 12 | 
            -
            end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            require 'cucumber/thinking_sphinx/internal_world'
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            world = Cucumber::ThinkingSphinx::InternalWorld.new
         | 
| 17 | 
            -
            world.configure_database
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            require "thinking_sphinx"
         | 
| 20 | 
            -
            require "thinking_sphinx/xml"
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            world.setup
         |